The ideal is to do really well at an Ivy league or very competitive school. I think it's harder to get really good grades at a State U. than at a Stanford/Ivy (having been either a student or on the faculty at both types).
I wonder if it depends on the type of course, but my husband would disagree and has a direct head to head comparison. He lived in a state where he was able to take college courses at State U as a high schooler (a State U that is considered to be academically rigorous and respected nationally). He then went to an Ivy for undergrad. Said it wasn't even close in terms of how easy the State U math and science courses were compared to the courses at the Ivy. He was able to fly through his assignments for State U courses often on the bus home, whereas his Ivy courses literally had him up against some of the top students in the world in certain subject areas and he had to spend hours/nights/weekends to achieve good grades.
From my own perspective being faculty at a State U. and having attended an Ivy-equivalent top engineering undergrad, I feel overall there are just a higher percentage of those profoundly/exceptionally gifted kids that blow your socks off at the Ivy/Ivy-equivalents than what my husband or I encountered at State U. Not every kid is going to do well though in an environment where such a high percentage are super-bright over-achievers, it can be overwhelming/depressing/a struggle to not be "the top" and can irreparably damage some kids' self-esteem. I certainly had to re-adjust my self-perceptions/identity, but for me, the 'downside' of no longer being "the best" was far outweighed by the upside of being with like-minded peers who "got me."