Depends on your state. Some states you cannot loan a friend a gun, that is a transfer, even a temporary transfer. Lots of states have goofy laws that should be illegal under the Bruin case, but are not. In those states like New York or Hawaii, and others where you can only possess the guns on your permits, it may be a serious crime. Especially if you take it on a trip from his house to yours or even if he drops it by and leaves it.
The easy solution is very simple. Go over to his house and teach him how to clean it. Or have him come to your house. Just do not let him leave the gun at your house. The longer the gun is at your house the more it looks like a permanent transfer.
If you are talking about federal law, there should be no problem, unless the gun crosses a state line, then you run afoul of the law that makes it illegal to sell or transfer a gun to a resident of another state. The risk is somebody steels that gun and uses it in a crime and they trace it back to the original owner and maybe to your friend. But then you reported it stolen. Or he reports it stolen from your house, that creates a problem in some states, or if the two of you are in different states.
If you and the owner of the gun are residents of different states, leaving a gun in your possession could be a crime in both states, even though you do not live in the other state. Generally, there is a rule that you cannot be prosecuted by a state you do not live in or have never visited, it is called the minimum contacts rule. However, longarm statutes often reach people who have never been in their state, but they can still be prosecuted by the other state. An example might be if your friend or relative had you ship the gun back to them in a prohibited state and somehow the gun was intercepted. They might file charges against you but then they would have to try and extradite, not likely. However, nobody wants to have a pending arrest warrant from some state far away, you are always at risk if you ever go to that state, and that outstanding arrest warrant would likely prevent you from buying a gun, getting a passport or things like that. Unlikely and bizzare, but having been a prosecutor I can see some radical DA in places like Chicago or New York filing such a charge. Never worth the risk in my view. Don't send guns or ammo to communist states.
And there are some other goofy things that might apply. For example, if your buddy is under a protective order and dropped it off for cleaning, you cannot legally give it back to him. There are both state and federal laws that apply to issues like that. Or if he is a convicted felon and drops it off for you to keep and clean a few days, you cannot give it back to him. Sounds goody, but it is always a crime to give a gun to a prohibited person, even if it is his gun. If a prosecutor is trying to prove there was a transfer, the longer it stays at your house, the harder it is to defend that it was just there for a repair. As a thought, it would be a good idea to have a series of emails, documenting the repair, when you got the parts, and how long the repair might takes. A time line of repair issues, documents that it is just a repair. Of course, any email you talk about a gun, could be used as evidence of a gun crossing state lines, possession and all of that. If you do something illegal, you surely do not want to document it.
There have actually been lots of family cases where people ended up in jail. Usually they are straw purchases where a guy buys a gun for a family member in another state, and the gun is traced back to him. Guns get stolen then used in a crime, they track it back to everyone in the loop.
In the free states like Oklahoma, Kansas, Texas, Tennessee and others there is zero wrong with repairing all of your family firearms and there should not be. Drop them off, leave them 10 years, nobody cares, just depends on where they live and where you live.
I think your question focused on the need for a federal license, as a "gunsmith", I agree with others, if you do it totally for free, there is no problem with the license issue, except for the state law issues mentioned above. And of course, do not move them across state lines. That can always be a seperate federal issue.
If you ask for a lawyer answer you get lots of what ifs, maybe and not necessarily and depends on where you are. The only way you get a yes of no answer is when the facts of the case are in explicit detail. And then, there is always, the, maybe, if the local judge has a different view of the law. The speed limit is about the only law that you know for sure is what it says. Well, except when it rains or snows and then that speed is too fast for conditions.......LOL