A good school is one that has the best students. It is often your classmates, more than teachers, who create an environment that is conducive to learning. What seems to be the case is that rich people invest more in their kids, and their kids are simply better students. They are better behaved, with higher comprehension and math skills, and more likely to be better students. That is what creates a good school.
So it is not that schools get richer with better resources (although that too is a factor), but that richer kids with higher parental investment are fundamentally more likely to succeed. That is the real divide.