I'm going to add to this, your letters of recommendation are critically important.
Furthermore, getting into grad school is the same thing as any other job. It's not about what you know, it is about WHO you know.
People will get you into grad school IF they want you, and they only know if they want you, if they know you. Simple as that. Face time really matters, so if you want to get into grad school but don't have fantastic letters of rec for whatever reason, make an impression on some of the faculty at the school. Go to conferences and attempt to meet professors in the schools that you are interested in.
Also, as stated above, you can always move into a top their school later in the game. For example, I went to a state school for my undergrad and PhD, but I've since moved onto Cornell, Columbia and Rockefeller. The school matters at some level, but you can make stuff happen when you apply yourself. As with anything else, it's not trivial, but it's kind of a fun game:) Best of luck, Keith