it's a Federal crime called a straw purchase and it's a felony.
In the context of United States federal gun laws, a straw purchase is defined as any purchase from a dealer holding a Federal Firearms License where the buyer conducting the transaction is acting as a proxy for another person. The law does not distinguish between someone who is purchasing on behalf of a person who legally cannot purchase or possess a firearm, and one who is not.
In the United States, straw purchases are a felony violation of the Gun Control Act of 1968 for both the straw purchaser (who can also be charged with lying on Federal Form 4473) and the ultimate possessor. One of the questions on Form 4473 is “I am the buyer of this firearm” and the purchaser must answer honestly yes or no, by checking the appropriate box in ink. However, purchase of a firearm as a bona fide gift for someone who can legally own such a firearm is permitted.