To strengthen his credibility in the gang, police arranged for a fake search warrant of his lock-up in which they had placed apparently stolen equipment and drug paraphernalia.
Police forged an illegible signature of a court deputy registrar and arrested Wilson.
Wilson appeared on several occasions before judges who all believed they were dealing with a genuine case.
Detective Superintendent Rod Drew Detective Senior Sergeant Warren Olsson visited then-Chief District Court Judge Russell Johnston and believed police had his permission to go through with the unprecedented ruse.
Soon after Operation Explorer ended, police sought to have Wilsons' charges withdrawn.
Justice France said he believed police thought they were acting legitimately, but a letter police gave to Judge Johnston about the situation would have been "wholly inadequate" to alert him to the realities of what was involved.
Justice France said he was surprised at the police's "lack of insight" in creating a fake search warrant.
"However one looks at it, a fraud is being committed on the courts. The judges who are dealing with it are being treated in a disrespectful way," he said.
"It is no function of this court to facilitate a police investigation by lending its processes to the false creation of street credibility."
There was fundamental and serious abuse of the court's processes by the police, he said.
Police Association president Greg O'Connor called the decision "disproportionate and unjustified".
"Police acted in good faith when taking these measures to protect the agent's life, and acted with the knowledge and agreement of the then-Chief District Court Judge, Russell Johnson, in doing so.
"To have the court now effectively change its mind is a slap in the face for the agent who put his life on the line for over a year."
The fact the agent had an artificially constructed back-story did not cause, encourage or enable anyone to offend, Mr O'Connor said.
Operation Explorer was overseen by Detective Inspector Grant Wormald, who also headed the joint raid on internet millionaire Kim Dotcom's mansion for the Organised Financial Crime Agency (Ofcanz).
Police said they were studying today's decision and would be taking advice and considering options.
Police Minister Anne Tolley said she maintained her confidence in the police but would not comment on Mr Wormald's involvement in the operation or the decision by Ofcanz to attempt the fake prosecution.
Lawyer Steven Rollo, who represents a number of the Red Devils Motorcycle Club, said the decision essentially said the police could not break the law to enforce the law.
"If this sort of conduct by the police was to continue and become part of their entrenched modus operandi then I think there would be grounds for the public to be concerned."
The decision could also have implications for Philip Ernest Schubert, a former president of the Mt Eden chapter of the Hells Angels Schubert faces a charge of offering to supply methamphetamine and was arrested in the same operation.
Schubert's lawyer Eb Leary said he was confident his client would be treated in the same way and would have his charge dropped.