There is a glitch/exploit I found to get a lot of 5mm ammo. What you need is to have a minigun and just 1 unit of 5mm ammo. Go to the location inhabited by raiders, kill one of them and put minigun and 1 unit of ammo into his inventory, step back and wait for his friends to come. Eventually, one of them will come to the body and grab minigun from it. Wait for him to unleash it then kill him and loot his body. Although it looks like he still has only 1 5mm ammo in his inventory you actually receive a good deal of it (I believe he starts with 500 bullets and you'll get it minus whatever he was able to shoot). Repeat this as many times as there are enemies nearby. It would be great to come in power armor as sometimes raiders need time to realize they can get minigun and they will still shoot you from their other weapon for some time.
1) It works on any sentient humanoids (gunners, synth, supermutants, non-feral ghouls)
2) For some reason it doesn't work on enemies that are originally equipped with melee weapons - they will never grab any ranged weapon
3) It works generally on any container you can place gun and ammo into (even on dead creatures)
4) Sometimes some enemies may completely ignore the minigun on dead bodies. Placing minigun and ammo on a new dead body may help
5) You MUST wait for an enemy to unleash the minigun and make at list one shot. If you kill him before it, you will get just this one bullet back