Most of the time, most places, things like this do not happen, but, there have been cases of police taking guns
Let me testify based on first hand personal experience.
I had a rather distinctive match rifle. It had a stock made of an early type of laminated wood, back before such stocks were "in". Because of that & the thumb-hole configuration it was a stand out in a crowd, or on a firing line. The light/dark wood's "tiger striping" was highly visible, very unusual & quite eye-catching, even though that wasn't the purpose of the wood choice. These were primarily made, pretty much exclusively, by an individual, who I happened to know. "Plywood" stocks were considered Gauche at the time & so were rare.
A shooting occurred & the recovered projectile was identified as having been fired from that exact type & caliber of rifle. The shooting was high profile as well, a convicted (& extraordinarily depraved rape/killer who violated the victims after death & specialized in nurses) psychopath was only able to be given a light sentence based on technicalities. When he was released after a very short sentence he was shot dead exactly as he exited the prison property by an unknown & never identified marksman.
Because of the outcry all rifles of that caliber & type in the region were called in for ballistic testing, mine included. Being a good citizen group all the shooters with the same model & I complied willingly to help expedite the investigation.
Months pass & the match shooting season begins. Everyone I talked to had their rifles returned, but not me. I inquired at the local police station & the firearms Sargent agreed to pursue it as it was abnormally long. Time passed & he got stonewalled, he was quite frustrated by the process. Meanwhile I'm shooting matches with a (technically quasi-legally) borrowed rifle. We were most of the way through the season & during a break for swapping ends I wandered down the firing line "checking out the competition" a fairly normal thing to do several others were doing the exact same thing.
Guess what I see? Yup a tiger-striped rifle identical to mine! I went over to look as it was obviously someone else who had the same custom stock maker. Now it gets weirder, it had the same serial number!
I checked with the R/O & guess who was registered to that point on the firing line? The PD from the town where my rifle was sent for testing.
The firearms Sergeant & I subsequently discovered my rifle had been "lost in processing, after legal surrender" & they had to both financially re-reimburse me (that took 3 years) & have the documented serial number struck off as "Lost in Custody" & the "slot" cleared on my permit, so I could never be involved if it ever came up on a "hot sheet".