It's actually legal to buy long guns from a dealer in another state, but not so with handguns. To buy a handgun from an individual in another state only in the sense that you might get caught, i.e. you later sell the gun and ends up used in a crime and is traced to the person you bought it from. Then, if he says he sold it to you, you might get charged with the out of state purchase.
Many years I took two old shotguns to another state; sold them at a gun show to a privat person. Yeaars later I learned I was in violation of federal law. No wait. I didn't actually do that. I didn't. No I did not.