A modest amount of reasoning will lead a reader to the understanding that this is a metaphor. What defines a prison:
* People are placed there involuntarily.
* Their freedom of movement is confined to the prison at all times (sometimes people serve prison on weekends, so I guess that's an edge case).
* They are put there because they are criminals (or political prisoners, in the case of corrupt countries).
* They are intended as either punitive measure or because we decide society is not safe if certain people are allowed outside of prison.
Schools do not exhibit any of these characteristics. Attendance is not mandatory, as parents can homeschool their children or take them to private schools. They don't live there, they usually only attend from morning to afternoon during weekdays. The purpose is not punitive, it's educational.
Look at the quote in context. This is where prisons are first mentioned:
> Why is the real world more hospitable to nerds? It might seem that the answer is simply that it's populated by adults, who are too mature to pick on one another. But I don't think this is true. Adults in prison certainly pick on one another. And so, apparently, do society wives; in some parts of Manhattan, life for women sounds like a continuation of high school, with all the same petty intrigues.
> I think the important thing about the real world is not that it's populated by adults, but that it's very large, and the things you do have real effects. That's what school, prison, and ladies-who-lunch all lack. The inhabitants of all those worlds are trapped in little bubbles where nothing they do can have more than a local effect. Naturally these societies degenerate into savagery. They have no function for their form to follow.
(skip one paragraph)
> The other thing that's different about the real world is that it's much larger. In a large enough pool, even the smallest minorities can achieve a critical mass if they clump together. Out in the real world, nerds collect in certain places and form their own societies where intelligence is the most important thing. Sometimes the current even starts to flow in the other direction: sometimes, particularly in university math and science departments, nerds deliberately exaggerate their awkwardness in order to seem smarter. John Nash so admired Norbert Wiener that he adopted his habit of touching the wall as he walked down a corridor.
He puts schools, prison, and high-society wives in the same bucket because they are both communities where the members of the community did not choose to be a part of that community and there is very little constructive way to increase social status. The result is that changes in status is mostly destructive: one improves one's standing by pushing others down. It's not that "schools are used as prisons".