There are plenty of guns marked "M9" since the Beretta contract doesn't prohibit Beretta from putting that designation on pistols for civilian sale. AFAIK, there is zilch difference between the civilian pistol and the military except for the serial number and the U.S. marking.
The problem with acquiring a "real" military M9 is that none have been released for sale, so any you could buy would be assumed to have been stolen property and could get you in deep trouble.
Just FYI, courts WILL take the government's word if they say no government-owned M9's have been sold or released to civilians. If you have one, you will almost automatically be found guilty of either theft or possession of stolen goods. (It happened with M1 carbines before they were sold through DCM; after that, the government would have had to prove theft/possession of a carbine having a specific serial number.)
Jim