I was travelling with Strong, and I dropped a bunch of items on the ground to scrap (armors/clothing, mostly, but I figured I'd take care of some weapons while I was at it). I accidentally dropped a Laser Rifle (clicking too quickly).
Well...
Strong comes sauntering up and grabs the rifle. I was like, "Hey! What in the sam hill do you think you're doin', you...sam hill!?" But Strong was all like, "Milk and love, baby!"
I decided to let this go. After leaving and wandering...I don't know...north?...we encountered a few raiders, and Strong was all like -- PEW PEW PEW.
Sure enough, he just fired like crazy. I checked his inventory afterwards, and sure enough, again, there were 14 Fusion Cells in his inventory. The ONLY things I ever gave to Strong were a super-sledge and some armor. I NEVER gave him fusion cells.
I think...
If an NPC picks a weapon up off the ground on their own...they get infinite ammo for it! (This is vanilla v1.1.30 -- the only mod I'm using is Darker NIghts.)
EDIT: It was not a legendary weapon. Just a lightly modded automatic laser rifle.