Gun laws are always written in such a way as to prevent normal everyday people from understanding them. These laws are always mired in complexities and exceptions, this makes it very difficult to understand if you are breaking the law or not. The question remains though, can you give someone a gun as a gift for a birthday, Christmas, or whatever holiday serves as a reason to give gifts? The short answer is yes, but you need to be very careful.
First, we recommend giving someone money or a gift card as well as your recommendation as to what gun to buy with the money/gift card, this may save you a headache or possible prison time. If you are really dead set on the idea that you want o get someone a gun as a present then you need to make a sure you have all of your ducks in a row.
Firstly you need to make sure the person you are gifting a gun is legally able to own a gun, this requires some questions and a lot of paperwork so if you were hoping to keep this a surprise you are SOL. Please note that giving a firearm to someone who is not legally allowed to own one is a FEDERAL CRIME, this can get you in serious trouble and put you behind bars for a very long time.
Also note that those under the age of 18 are not allowed to own handguns and in some states the law various on age and ownership of certain firearms.
As for the transfer of the Firearm, in some states you are required to transfer any gun through a licensed dealer. Check your local laws to ensure that if you live in one of these states you do things appropriately and go to a licensed dealer. Some states do not require this but make sure to check your local laws anyway just to be sure you are not breaking the law.
When it comes to shipping a firearms there are a few rules. All handguns must be shipped through a common carrier but long guns can be sent through common carrier and U.S. Mail. When shipping these firearms must be sent to a licensed firearms retailer, not to the individual who you are gifting the firearm too. Federal Law also requires that you declare that the package contains an unloaded firearm. To ensure your firearms are not lost and everything is done legally consult with the carrier you intend to ship with, they may also have their own regulations and rules when it comes to shipping firearms.
Be very careful with everything when it comes to giving a firearm as a gift, the federal government will haul you off to jail even if any error was just an honest mistake, they do not play around when it comes to guns.
For more information on this topic, the National Shooting Sports Foundation put out a fantastic article about gifting guns that you can read here.