A while ago I was thinking the same about compensation but then someone pointed out that if you were eligible for one, they would have incentive to not let you go.
It would be cheaper for everyone to just keep you unfairly.
This is why Supreme Court justices are appointed for life. At least in theory, they'll carry out their job impartially because they don't have to run for re-election. They'll hold their position long past when the current administration so any conflict of interest should be mitigated over time. Directly electing judges has its own set of problems. I'm not trying to argue for one way over the other, just pointing out that the executive branch appointing judges is not inherently wrong.
first off, given the context of having kept someone 22 years this sounds ridiculous.
If they kept someone 2.2 years and then didn't compensate you could argue incentives to keep but after a certain amount of years it seems like there isn't any difference between what they actually are doing and how they would behave with incentive not to let you go.
Aside from that there could be ways to structure compensations, for example a scheme where you get less compensation per year for short time, more compensation per year for longer time might make them want to let you go and cut their losses once they determine you were innocent.
I'm sure it's a few levels more complex than that though; the ongoing cost of incarceration might for example include paying for jobs and services and often is a big part of the county or town economy.
They might not pay it out of the pocket, but they may pay with their jobs one way or another:
Elected judges and prosecutors may lose elections when the electorate hears they shell out huge compensations, especially to people the electorate is not really convinced are innocent (because unlike the judges, who were at the trial obviously, the electorate learned only a tiny fraction of information about a case from more or less reliable media sources at best, and outright rumors and gossip at worst).
Appointed judges are still appointed by somebody, and that somebody is a (group of) politician(s). These politicians have the same issues as the elected judges and prosecutors, and may avoid this (or even retaliate) by not appointing judges (to higher circuits) that are perceived to be risky in this regard, effectively killing the careers of these judges. So if you want to become an appointed judge, you still better pay close attention to the political scene and play ball.
It would be cheaper for everyone to just keep you unfairly.