https://malegislature.gov/Laws/GeneralLaws/PartI/TitleXX/Cha...
Here the exemption is for:
> (h) Possession of rifles and shotguns and ammunition therefor by nonresidents traveling in or through the commonwealth, providing that any rifles or shotguns are unloaded and enclosed in a case;
I'd think that it would be hard to argue that "traveling in or through" doesn't include staying in some sort of accommodations during your trip.