I would guess that’s depends on the country, all of those have problems with funding, but they differ on the punitive philosophy. For example argentinean prisoners can get jobs that pay the legal minimum wage and all the normal labor rights any worker enjoys, in Brazil they can read books and wrote essays about them to commute prison time, but their jails still lack proper infrastructure and are overcrowded.