The judge doesn't care if the law was violated in collecting evidence.
Maybe this particular judge didn't for whatever reasoning, but judges definitely prevent a prosecutor from introducing evidence based on how it was collected. This is why concepts like "fruit of poisonous tree" and "parallel construction" exist.
I had a judge once tell me that the police absolutely have the right to commit crimes to gather evidence in an investigation.
(mostly true -- for instance an officer can generally commit innumerable felonies as long as nothing they do violates your personal constitutional rights -- rarely is evidence thrown out because it was obtained in violation of a statute unless that statute includes a provision for exclusion, e.g. wiretapping laws)