The real life version is a company sues you for a stupid reason and after spending a couple hundred thousand dollars on your defense the company loses and says "our bad lol", and then the matter is settled.
Or, in this case, after prosecutors hold someone in prison for a decade or two they offer a plea deal.