Presumably people don't do that because having a bankruptcy on your record comes with consequences. It might even disqualify you from persuing certain careers.
if you have a reasonable student loan balance and a solid job offer (maybe you got a stem degree from a public university), it would still be much better to make payments and have access to other credit.
Which is realistically a worst case scenario because there will always be someone who will try to figure out how to correctly evaluate the lending risk of people who are all equally handed free money and thus for whom the bankruptcy signal doesn't differentiate much.
And as a fresh college graduate I'm necessarily the most mobile I will likely ever be in my life, with no kids yet and maximum disposable income relative to my needs at this time of young adulthood, thus unlikely to be able or interested in looking for a settle-down home anyway for several years?
better believe I'll take that deal, or I would if I was back in that age group and stage of life.
total in-state tuition for a four year degree is ~$40k. that's not nothing, but at least for me, getting that wiped out in exchange for no house, driving a shitbox to work, and even getting extra scrutiny on rental applications would not have been a good start to my 20s.
if I went to a private school, wanted to be a teacher, etc, the calculus might be different.
Obviously there's the option of a less expensive State School like one of the CSUS or a Cal Poly, as well as clever short circuiting of the tuition by taking Community College equivalents where possible but if you're going to get everything forgiven at the end of college then why bother with all that.