In my experience state schools that weren't very selective were also the ones offering scholarships for students with high grades/test scores etc. Many of my friends went to the school they did instead of a more prestigious one due to being offered more tuition assistance/scholarships for their high school achievements.
Personally I was able to skip a full semester and change of classes thanks to taking every AP course I could during high school as well
As an example, Georgia offers scholarships for all students above certain GPA cutoffs. The Hope and Zell Miller programs, specifically, pay for many students to attend schools like UGA and Georgia Tech.
Many programs and scholarships have grade cutoffs or maintenance requirements and while scholarships aren't entirely based on grades the grades are often a prerequisite.
How do they make it cheaper to go to college?
Merit scholarships that are based mostly or entirely on grades are relatively rare and extremely competitive.
And the cheapest colleges are often the least selective ones (like community college or state schools).