If your destination is Boston and you are not just "traveling through", you are pretty much out of luck. If you were traveling through on your way to somewhere else, then the U.S. Code would apply and you would be legal keeping it unloaded in your trunk. However, if you are staying in Massachusetts, and then going back home, don't get caught bringing your gun with you UNLESSyou meet one of the following exceptions.
GENERAL LAWS OF MASSACHUSETTS
PART I. ADMINISTRATION OF THE GOVERNMENT
TITLE XX. PUBLIC SAFETY AND GOOD ORDER
CHAPTER 140. LICENSES
Section 131F. A Class A or Class B temporary license to carry firearms or feeding devices or ammunition therefor, within the commonwealth, may be issued by the colonel of state police, or persons authorized by him, to a nonresident or any person not falling within the jurisdiction of a local licensing authority or to an alien that resides outside the commonwealth for purposes of firearms competition and subject to such terms and conditions as said colonel may deem proper; provided, however, that no license shall be issued to a person who:
(i) has, in any state or federal jurisdiction, been convicted or adjudicated a youthful offender or delinquent child for the commission of (a) a felony; (b) a misdemeanor punishable by imprisonment for more than two years; (c) a violent crime as defined in section 121; (d) a violation of any law regulating the use, possession, ownership, transfer, purchase, sale, lease, rental, receipt or transportation of weapons or ammunition for which a term of imprisonment may be imposed; or (e) a violation of any law regulating the use, possession or sale of controlled substances, as defined in section 1 of chapter 94C;
(ii) has been confined to any hospital or institution for mental illness, unless the applicant submits with his application an affidavit of a registered physician attesting that such physician is familiar with the applicant’s mental illness and that in such physician’s opinion the applicant is not disabled by such an illness in a manner that should prevent such applicant from possessing a firearm;
(iii) is or has been under treatment for or confinement for drug addiction or habitual drunkenness, unless such applicant is deemed to be cured of such condition by a licensed physician, and such applicant may make application for said license after the expiration of five years from the date of such confinement or treatment and upon presentment of an affidavit issued by such physician stating that such physician knows the applicant’s history of treatment and that in such physician’s opinion the applicant is deemed cured;
(iv) is currently subject to: (A) an order for suspension or surrender issued pursuant to section 3B or 3C of chapter 209A or a similar order issued by another jurisdiction; or (B) a permanent or temporary protection order issued pursuant to chapter 209A or a similar order issued by another jurisdiction; or
(v) is currently the subject of an outstanding arrest warrant in any state or federal jurisdiction.
Such license shall be valid for a period of one year but the colonel may renew such license, if in his discretion, such renewal is necessary.
The colonel may also issue such license, subject to such terms and conditions as he deems proper, to any resident of the commonwealth for the purposes of sports competition.
A temporary license issued under this section shall be marked “Temporary License to Carry Firearms”, shall clearly indicate whether it is Class A or Class B and shall not be used to purchase firearms in the commonwealth as provided under section 131E. Neither a large capacity firearm nor large capacity feeding device therefor may be carried unless such person has been issued a Class A license; provided, however, that the colonel may permit a Class A or Class B licensee to possess large capacity rifles or shotguns or both, and such entitlement shall be clearly indicated on such license. The fee for an application for the license shall be $100, which shall be payable to the licensing authority and shall not be prorated or refunded in case of revocation or denial. The licensing authority shall retain $25 of the fee; $50 of the fee shall be deposited into the general fund of the commonwealth; and $25 of the fee shall be deposited in the Firearms Fingerprint Identity Verification Trust Fund. A license issued under the provisions of this section to a non-resident who is in the employ of a bank, public utility corporation, or a firm engaged in the business of transferring monies, or business of similar nature, or a firm licensed as a private detective under the provisions of chapter one hundred and forty-seven, and whose application is endorsed by his employer, or who is a member of the armed services and is stationed within the territorial boundaries of the commonwealth and has the written consent of his commanding officer, may be issued for any term not to exceed two years, and said licenses shall expire in accordance with the provisions of section one hundred and thirty-one.
A license, otherwise in accordance with provisions of this section, may be issued to a nonresident employee, whose application is endorsed by his employer, of a federally licensed Massachusetts manufacturer of machine guns to possess within the commonwealth a machine gun for the purpose of transporting or testing relative to the manufacture of machine guns, and the license shall be marked “temporary license to possess a machine gun” and may be issued for any term not to exceed two years and shall expire in accordance with the provisions of section one hundred and thirty-one.
Section 131G. Carrying of firearms by non-residents; conditions
Section 131G. Any person who is not a resident of the commonwealth may carry a pistol or revolver in or through the commonwealth for the purpose of taking part in a pistol or revolver competition or attending any meeting or exhibition of any organized group of firearm collectors or for the purpose of hunting; provided, that such person is a resident of the United States and has a permit or license to carry firearms issued under the laws of any state, district or territory thereof which has licensing requirements which prohibit the issuance of permits or licenses to persons who have been convicted of a felony or who have been convicted of the unlawful use, possession or sale of narcotic or harmful drugs; provided, further, that in the case of a person traveling in or through the commonwealth for the purpose of hunting, he has on his person a hunting or sporting license issued by the commonwealth or by the state of his destination. Police officers and other peace officers of any state, territory or jurisdiction within the United States duly authorized to possess firearms by the laws thereof shall, for the purposes of this section, be deemed to have a permit or license to carry firearms as described in this section.