The gun is a P7A10 made for the XM9 trials in 1983. It wouldn't be accurate to call it an M8.
The mag is certainly interesting, though I don't see it as a one-off. It is most definitely a factory item, and quite a few were produced.
The coolest thing (to me at least!) about my XM9 pair is that both guns have the exact same serial number.
If I had to guess I would say that the P7A10 was a rushed job to meet a deadline and requirement minimum.
The P7A13 was later finished in time to replace the A10s that had previously been submitted, hence the reason for making them with the same serial numbers.
Maybe HK wanted to swap the somewhat embarrassing A10s for the much nicer A13s, and hopefully if all the serial numbers were the same, the Army wouldn't notice? I really don't know for sure. It just always seemed odd that these guns would have the same serial numbers. Duplicating exact serial numbers in production guns isn't all that common I would imagine. Hopefully G3K can correct me if my theory is totally off base.
Needless to say it wasn't easy finding a matching pair! Aside from the P7M7, this pair is definitely my second favorite in my collection.
End of the day
I thought I had a good collection with just 3! I was humbled rather quickly!!!