The grad students are not only getting a free education, they're also getting paid a stipend on top of that. Grad students tend to have extremely flexible schedules, freedom to pursue their intellectual interests, the ability to attend seminars and travel to conferences, etc.
At least in STEM fields, anyone in grad school probably could have gotten a higher-paying job in industry, but chose to attend grad school, knowing the tradeoffs, because it's what they wanted to do with their life.