Before things were relaxed some by the 1986 FOPA, there were restrictions against buying even long guns outside your own state. Since it's now obsolete law, I'm not up on the details, but apparently it was all right to buy long guns in an adjacent state, but no further away.
Some states still have their own legislation on the books restricting long gun purchases by their residents to listed states, or to states sharing a common border.
Federal law no longer has such restrictions, but if a state law is still on the books, it applies, as federal law states that sales of long guns to out-of-state residents must comply with the laws of both the state of sale and the purchaser's state of residence.
For instance, since California requires firearms transactions to go through a California dealer (to make a DROS - dealer record of sale) it is illegal for California residents to purchase firearms outside California.