You jumped from “the prosecution”, which is an Executive branch function to “the judicial branch” ~ so who is it you imagine should pay?
The one that brings a trumped up charges, for personal gain. I’ve seldom seen a judge (judicial branch), that didn’t formerly work as a prosecutor (executive branch), but that’s besides the point.