Hmmm - prison = food, clothing, shelter, in some cases a good gym membership and now your own tablet with internet and skype and probably easy access to porn. What's the deterrent to crime then?
The conditions in prison are rarely effective as a deterrent anyway, either people think they'll get away with it (typically theft, burglary, mugging, robbery, trafficking illegal goods, fraud, embezzlement and related crimes) or crimes of passion (rage, lust, envy mostly, often combined with being drunk or high - most violent crime, rape and murder) where they're not thinking rationally of consequences. While there are certainly repeat offenders there's also many first-time offenders that have no real concept of what doing time is like or small time criminals that confuse being off the streets for a few weeks on minimum security with being locked up for years.
And most criminals don't return or not return to prison because of how the conditions are on the inside. They return because they don't really see any alternatives to the life they have on the outside. No money, no job, no CV or work history, so it's back to stealing or peddling drugs on the street corner. Or they have impulse control or substance abuse issues that don't just disappear with time. And if prison is some horrible hellhole then you have these "nothing to lose", "never going back" people who will do anything to get away with it and fight the police until they die in a rain of bullets from a SWAT team. They need to see that there is another way, in prison and after prison. Not everyone will want to change, but you can't whip them into changing.
Getting proper apples-to-apples numbers on the effect of treating prisoners humanely is very difficult, but it generally varies from "it helps" to "it doesn't hurt", there's really very little to suggest it makes things worse. It's mostly a matter of whether it's money worth spending. Here in Norway we created what the international press called "the world's most humane maximum security prison" but mainly it's that it is built like a normal living quarters like a dorm room or hotel room. No escapes, very low tension even though it's murderers and rapists. Even gangs keep the peace inside the prison, it's like everybody is on time-out. And quite many find they like it better than the life they had.