As far as federal law is concerned, you can buy a long gun from a dealer in a state in which you do not reside and, assuming you pass the NCIS check, take the gun home with you. Some states may have laws restricting this, however--as either a buyer or a seller.