Even if we were to consider a nice prison focused around rehabilitation and not exploitation, there are still things the prisoner is forced to do. They are forced not to leave. They are forced to follow certain rules. They are forced to move between locations at certain times of the day. They may be forced to attend classes or do specific types of labor like cleaning their rooms or common areas. Unlike a job where you might be 'forced' to clean, but you can always quit, quitting is rarely a choice for the prisoner and will result in worse punishment. Even if the prison does not directly profit off the labor of the prisoner, this level of control seems to be a form of slavery. Rarely do I see slavery defined as requiring profit to be made off the slave, though slavery rarely happens where it isn't found to be profitable by the person doing the enslaving (based on the enslaver's own view of what counts as profit).
If we were to fully ban slavery even for prisons, then for even nice prisons to continue to exist we would have to define some other non-slavery action which would include having control of where a person lives, how they live, when they sleep, and all the other powers of a prison. In such a case, it would then be possible for a state to allow this non-slavery even for people not convicted of a crime, because it isn't slavery and thus isn't a violation of the 13th amendment. Generally things like kidnapping laws as they currently exist would prevent any private entity from doing this, but exceptions might be carved out. On realistic example would be teen rehabilitation camps which already can border on the legal limits of kidnapping, false imprisonment, and slavery. Some stories from these places already sound like they might be crossing the line, though that might only be allowed as long as they are dealing with minors with parental approval. I could reasonably see a state extending such treatment until the teen is 21 or such.