How is it moral for people to get rich from imprisonment?
When the top of society is greedy, you can't expect the lowest rungs to be any better. We barely care about people if they are contributing members of society (unless you've got money), we sure as hell aren't gonna care about prisoners.
It's just hypercapitalism. You sound surprised, but it's business. If you can exploit, you do exploit as far as legally possible and then make excuses later. I bet you the contractors have some great justifications for why what they do isn't immoral and is even good and necessary.
Short answer: it's not moral, but we're greedy and it's hard to admit that.