The top ranked doctoral programs get the cream of each year's application pool because they can offer access to the top professors, top research libraries, and have tons of money to spend on tuition waivers, stipends, summer research money, etc. They can effectively outbid other programs and choose the people who seem to have the most promise (or are advantaged in having Famous People write for them, etc. etc.).
Graduate students at top ranked programs don't have to spend as much time doing non-research activities such as teaching and waitressing to pay the bills as they're getting most of their living expenses covered. They instead can focus on their research and publications, resulting in a flush CV by the time they graduate.
This leads grant agencies and hiring departments to assume that the graduating students at the top ranked programs are indeed the best of the best. They certainly have the imprimatur of the Best Programs® and Famous People® are writing them letters of support.
This is almost certainly a flawed assumption, but when faced with 200 grant or job applications, it's a shortcut many search committees make. Ideally they should just look at the candidate's qualifications without considering the school or the Famous People® who wrote for them.
But even if we redacted program names in applications, the very fact that having gone to a top-ranked place gives people a huge material difference/advantage in resources available while they are in the program, and this is evident in their CVs.
In a totally fair world, we'd do what google does and throw away CVs and letters and instead grill people one on one. But try to convince a provost to do that.
Note 1: People can and do move from lower ranked to higher ranked schools, but usually they don't do it in their first job. Rather, from a low-ranked they get hired at a mid-ranked school, then through publishing and publishing and publishing, they get hired away into a top-ranked (perhaps going through one or two job hops along the way).
Note 2: Top ranked universities (as well as everyone else) have overproduced so many PhDs in pretty much every field that there is market saturation. Even graduates at top-ranked programs are having trouble finding jobs -- even as adjuncts and NTT faculty. In a true market economy, the suppliers would be forced to lower production in the face of oversupply, but academia is not a market economy and having doctoral students is seen as a source of prestige for both faculty and institutions alike. Unless we can increase demand (by forcing schools to hire TT faculty instead of contingents, or other means) or reduce supply, we're all screwed but the folks graduating from mid- and lower-tier schools are screwed the most.