Plea bargain, it saves a few thousand dollars of court expenses.
Talking a death penalty case. It saves 10s or 100s of thousands of dollars to plead out instead of successfully going for a death penalty. Most of the numbers seem to be from anti-death penalty folks, and are suspect, but the costs of trials, multiple appeals, and death row housing are clearly many times higher than a plea, no appeal, and general population even in a high security prison.