if it is a gun that is no longer available from a MA FFL, do the MA members a favor and post it here for sale, to keep it in the state. Once it leaves it isn't going to come back.
Otherwise you can bring it to NH (unloaded not concealed while transporting unless you have a NH non resident permit CCW) and trade it in on the long arm of your choice, filing a FA-10 when you get home so they'll know where to find it when the confiscation happens.
P.S. make sure the NH purchase meets MA requirements for long arms... no folding stocks, no bayonet mounts....