I lived in a small town, and the cops were convinced that people were selling drugs at the Burger King.
So they had one of the new cops go undercover there for three months, and all they managed to get was some idiots who had a gram of weed (in a medical state) and five vicodin pills. The judge threw it out and warned the town about wasting the court's time.
From what I've seen, most judges are pretty straightforward with that shit. A couple are annoying about it, but it's mostly the police force that pulls shit like that, and sometimes the prosecution as well.
Something about the police strikes me as odd. If a judge can stay uncorrupted by power, why cant police? Assuming that this is the reason for their actions.
Unfortunately judges can be corrupted too. They can accept bribes to rule favorably and their clerks can charge unsolicited fees to lose files or giving access to judicial decisions before they're scheduled to release.