There is no law preventing someone from giving a firearm as a gift to a friend or family member that resides in the same state. However, before you do, consider the legal responsibilities:
You must be certain that the person you are gifting the gun to is not legally prohibited from possessing that firearm. Is the person the minimum age? Does the person fall into any categories that might prohibit a gun purchase, such as criminal record, domestic violence, residency status (including out-of-state), mental history, etc? Keep in mind that giving a firearm to an individual who cannot legally possess that firearm is a federal felony, regardless of whether you knew all of the circumstances.
If the person resides in another state, it is federal law that the firearm must be shipped to a licensed dealer in that state and then transferred via background check to the individual.
Because of the nature of the ATF regulations and the risk involved (felony charges and losing your licenses), most gun stores will refuse a sale if it is made clear that the firearm is intended as a gift. ATF recommends that, at the gun store owner’s discretion, you purchase a gift card instead and let the individual buy the gun themselves and do the appropriate paperwork and background check.
Guns Etc does allow gift card purchases for these situations.
Finally, if any employee at any gun store suspects that a firearm purchase may be intended for another individual they have the right to refuse the sale. An unwillingness to purchase a gift card instead is a red flag to the gun store staff — why wouldn’t you purchase a gift card unless you intended on breaking the law?
For more information, see this article from the National Shooting Sports Foundation: https://www.nssf.org/articles/giving-a-firearm-as-a-gift-some-reminders-from-nssf/