Were you a resident of Massachusetts when you sold the land?
If yes, your income is taxable in Massachusetts and Maine. You need to prepare non-resident Maine return and resident Massachusetts return. On your resident return, You're allowed a credit for taxes paid to another state.
The Massachusetts Department of Revenue taxes residents on income from all sources.
For accurate calculation, prepare your nonresident return first.
If you lived in Maine and Massachusetts, you need to file part-year resident returns for each state and allocate your income. If you sold the land while you were Maine resident, the income is only taxable on your Maine return. On Massachusetts return, you report the income as Non-MA portion.