What is the purpose of prisons? Is the restriction of one's freedom supposed to be retribution for the crimes committed against society and the victim? Is it meant to be rehabilitative? Are prisoners supposed to emerge from the experience deterred from committing future crimes and morphed into law-abiding citizens?
Yes: the purpose of prison is punishment
Prison should be a punishing and unpleasant experience so that law-abiding citizens can feel safe