Sounds like a false dichotomy between "cases that will always result in guilty verdicts" and "cases that the prosecution knew they'd lose but brought anyway to drain resources". You don't seem to recognize that there are many, many cases that could go either way, based on how judges rule about evidentiary matters, what the composition of the jury is, etc.
As someone who was a lawyer for years, and who has served on a jury, I have seen the ways that things can evolve in unexpected ways. IMO the vast majority of cases could go either way, depending on how rulings and jury composition turn out. Any system that doles out taxpayer money whenever the prosecution doesn't run the table is utterly naive. It would result in less prosecution, more criminals going free, and more victimization by people we didn't lock up.