I am curious is this legal?

i am looking at guns i am turning 18 in a month and looking into rifles or maybe a handgun cause it is legal at 18 in my state my question is my buddy offered to sell me his handgun when i turn 18 is this legal like as in if i get pulled over and they see my gun what would happen if they run it and it ain’t in my name is there any law against that or is it legal to buy a gun from someone and not have it in your name just curious of the laws before i do anything

I am curious is this legal?
Post Opinion