With that reasoning, no one would ever be punished for anything.
If you think prsioners should be punished by being raped, then let's make rape a legal penalty.
And the government can hire rapists to carry out that sentence, in the same way the government hires executioners.