I AM NOT A LAWYER, NOR AN FFL HOLDER
My understanding is that federal law doesn't prohibit purchasing a long gun outside your state of residence. As long as it's legal in BOTH states, should be ok. (For example, if you live in a state where ARs are illegal, you can't buy one out of state and bring it back. Or if you would be a "prohibited person" in Hawaii, you couldn't buy a shotgun and bring it back.)
I believe out-of-state handgun purchases were prohibited by the Gun Control Act of 1968, but the federal court ruling in Mance v. Holder has muddied those waters... Regardless, I think you'd have a hard time finding an FFL that would be willing to risk it.