Nope. You have to pay taxes to the state where you earned the money, regardless of where you lived. For example, residents of NJ and PA who work in New York have to file a NY return to report their income as well as a return for their resident state.
You'll file a nonresident Massachusetts return to report MA-sourced income, and you won't have to file a NH return as you probably already know.