Is it surprising that prisons resemble factories, schools, barracks, hospitals, which all resemble prisons?
One of the central points of Foucault's discussion of the carceral system is that the form of discipline associated with the modern prison is not contained within prison walls, but derives from the society beyond those walls. The mechanisms of control, examination and classification operate within all the institutions that Foucault discusses. Indeed, power in its various forms flows through all of them. Prisons resemble these other institutions not just because they have similar architecture, but because they all fulfill similar functions.