Back in the day, those who would now be given 20 years or life, were executed. They executed horse thieves. Rome used prisoners to row war ships. They were warehoused in those ships for years and sometimes decades.
I don't know what the solution is but what we're doing now isn't working. Today's prisons are just training grounds for criminals. If they aren't hard core expert crooks when they went in, they are when they come out.