It costs more to keep a man locked up for a year than it would to send a deserving young person to virtually any college in the nation for the same length of time.
The obvious solution, which was the norm within my lifetime, is to make prisons self-supporting.
Interestingly enough, Washington state prisons used to have a reputation for this, going from raising much of their own food, meat and dairy products on prison farms (one of which is not that far from me), to prison industries that produced goods for both internal and government use as well as sold on the private market. Over the years, almost all of these efforts have been shut down, due to complaints from the business market that it represented unfair competition and decreased jobs in the private sector. So now the government has to buy all those services and products on the open market.
I have read a couple of magazine articles in the LA Times and a couple of other California papers about the tremendous political power wielded by the California correctional officers unions. The unions have the power to swing state elections, so their wages and benefits are among the best in the country and are one of the reasons why the California state budget has been brought to its knees by criminal justice costs. Legislators vote against prisons, prison staffing, or staffing wages and benefits at their peril.