I think Gordon Ramseys idea of getting prisoners working inside to generate income is a better one. I agree - along with providing education.
Most prisoners do either work or engage with education and/or training alongside any MH and drugs/alcohol type treatments whilst in prison, so long as they are not on a 'basic' regime where they are restricted much more on when they can leave their cell.
I worked in a male prison and was involved with 1:1 work with such men, getting them into the work, training and education and various treatments and schemes - all designed to aid rehabilitation and the ability to stay on the right side of the law on release. But all the education and training doesn't mean it will work for them all.
Everyone is expected to reach a given level of literacy and numeracy - think it is level 2. This is treated as a priority and could take place in classrooms, as part of work training or even in-cell study. Then there are other types of education available right up to degree level and beyond.
The work can include cleaning, hospital work, library work, gym staff, laundry, cooking the meals for the site, etc.
Training was usually workshop based but covered a range of vocational training.