Ugh, this keeps coming up and people still aren't getting it right.
If the friend entered on a non-immigrant visa, it is illegal for him to purchase/possess under 18 USC 922 (Ie: student visa, tourist visa, etc.)
It is also illegal for someone to give or sell that individual firearms or ammunition under 18 USC 922 (d)(5)(a) knowing their status.
Renting them a firearm at a shooting range is a violation of 18 USC 922, and yes, people have been prosecuted for it. There was a thread here within the last 2 months from someone in Holland (i think) that was asking a similar question, and I posted links there to the criminal case and court of appeals opinions, as well as ATF's opinion letter on this issue.
There are some exceptions under 18 USC 922(y)(2) if you can meet one of them. 922 (y)(2)(a) states that the prohibition doesnt apply if the nonimmigrant alien is in possession of a hunting license/permit lawfully issued in the U.S., and some people have simply used that route to get around the issue.
If they are here under the visa waiver program, and were not issued an actual visa, they are not considered a prohibited person under 18 USC 922 DOJ (ATF) has issued an opinion letter verifying that visa waiver entries don't qualify.
ETA: There is a customs form that can be used for competitive shooters entering the US, it must be submitted and approved PRIOR to entry, that exempts someone from 18 USC 922 for the purpose of sport/competition shooting.