Under the Law of Moses false testimony was punished by the penalty they tried to get the innocent person to suffer, up to and including the death penalty.
They didn’t have cops or prosecutors then, but I don’t see why we can’t apply the principle.
In (very) partial defense of the cops and prosecutors, they often believe (sometimes even accurately) that the person they’re railroading is a career criminal anyway, so what difference does it make if he is convicted of a crime he didn’t commit when he’s gotten away with dozens or hundreds of crimes?
I support Moses. He was the original epic beard man.