First, don't put too much emphasis on school. Great programmers can come from anywhere.
Many other commenters are emphasizing the role of selection effect: top-tier schools select good students, rather than teaching well. I think the effect of good teaching shouldn't be undervalued. Although, again, good teachers and courses can come from anywhere, here are some things CMU does or did in the way of pedagogy:
1. Focus on concepts and skills, not specific technologies. Many of CMU's intro courses are taught in Standard ML, a language used by basically nobody. This levels the playing field, forcing people who think they already know everything to learn things from a different perspective. It puts the focus on how to design and reason about programs, rather than the minutiae of popular languages.
2. Have project-based courses. The star example here is CMU's operating systems course, which is a thing of beauty and terror. At many schools OS courses teach you trivia about hardware. CMU's OS course involves some of that, but is mostly about (a) working with a partner (b) time management (c) designing concurrent programs. The compilers course is of similar quality.
3. Teach math-as-problem-solving. CMU has a course, 15-251, which is notoriously difficult, because it introduces you to a lot of discrete math very quickly. This is partly because discrete math is the core of CS theory; most programs will never need this, but when you do need it, knowing a bit of theory can save you days or months. But the other goal is to simply practice solving difficult conceptual problems.