Not even all top private schools are expensive. Stanford, for example, has some wonderful financial aid. Depending on someone's financial situation, they can easily graduate from Stanford med with less debt than they would have at their state school. (In fact, the average debt of graduating seniors there is about the same as the average debt at state schools).
As far as how it helps you for residency selection, I would say that going to a state school will not close any doors, but going to a top 10 will place you at an advantage. Many of the "top 10" residency programs are very inbred amongst themselves, and will be more likely to give more consideration to applicants coming from other "top 10's". I'm currently interviewing at some higher ranked residency programs, and out of the applicants I've been interviewing with, about 2/3 are from "prestigious" (read: top 15-20) programs. The rest, however, are from other schools that are not quite as nationally recognized, and it seems like they had to work much harder to get there than those applicants from top 15 schools did. The applicants from the top programs, from the way they describe themselves in informal conversation, tend to be more in the middle of the pack at their school, while the applicants from all the other schools seem to be the ones that stand out at their schools (getting all honors, AOA, etc).
So I guess my long-winded point is that I think it is certainly possible to get into those prestigious academic residencies from a state or lesser-known school, however you will most likely need to stand out in your class, which is much easier said than done. Another way to get more of an advantage from a state school is to do a visiting rotation during your 4th year of med school at a program you may want to do your residency at. That way, they will get to know you by who you are and not where you come from, and if you "wow" them, you will be considered very highly for residency there.
Last point is that you should look at individual schools' financial aid programs before you decide that your state school is by far the cheapest way to go. A school's published tuition does not tell the whole story by any means. There are many private schools out there that have very generous financial aid, but there are also many private schools that give no financial aid at all. Research that carefully.