Some of the companions randomly pick up different items. In my experience, not all of them do. I'm not sure what determines when they do or don't loot bodies. I think that's likely just random. I haven't paid enough attention to determine whether they only take certain types of ammo or if it's any type.
If you equip a companion with a gun, you'll need to provide them with ammo, even if it uses the same ammo type as their default weapon. I've found that it's best to stick relatively close to their default weapons when equipping them. Piper and Nick use pistols, so I've equipped them with really good modded pistols. Cait and Hancock both use a shotgun, so I equipped them with fully modded advanced combat shotguns. MacCready uses a sniper rifle, so I equipped him with a fully modded .50 sniper rifle. In any case, you have to provide them with ammo if you're equipping them with non-default weapons. If they run out they'll switch back to their default weapon.
It's worth pointing out that Settlers (not companions) will have unlimited ammo for equipped weapons as long as you give them 1 round.