This is what evidence bags are for.
Even if the “ultimate” conclusion by the jury and at appellate levels is that this remains valid evidence, it still resulted in wasting a lot of court time. We might well ask why do THAT? Because the officer felt so free to wing it? And if he’d wing something like this, what else would he wing?
FOR ALL WE KNOW...
The perp claimed it wasn't cocaine, so the officer in question picked it up and placed it in the perp's billfold, showing him that he was doing so, explaining that if it wasn't cocaine, then it would be in the perp's billfold safe and sound.
If he was 'winging' it , why did he do a show and tell with the other officer and the perp, and why would the other officer go along with 'winging' it ?
Finally, it matters not one whit, one iota exactly where the illegal drugs are found ON YOUR PERSON. What advantage/what benefit would the officer gain by inserting the drugs found in the shirt pocket into the billfold ?