The resell the debt to investors[1]. If students think these debts have to be repaid even if they don't then they are more valuable so yes, the school has something to gain.
They don't resell all the debt. And this make Lambda FAR less attractive. And if someone is going into bankruptcy it would be over far more than 17% of their salary. In which case they would find out if it's dischargeable or not.
This is only relevant if the revenue lost from those that don't sign up out of fear of not being able to pay back the loans, exceeds the number of students who do sign up and would seek bankruptcy if it was dischargeable but don't having been told it isn't.
Just like the student debt problem in general, I'd imagine most students seeking to attend the school are optimistic they can pay it back, whether this ends up being true or not, so this proposed effect is minimal.
Also, some portion of those that wouldn't sign up out of fear of un-dischargeable debt, would, if it was dischargeable, not end up paying back some of this debt to Lambda School. So earning their trust as customers isn't much of a net benefit.
Putting all of these points aside, why did they do it? If it made their school overall less attractive to a point of diminished revenue, this would have been doubly stupid as it added regulatory risk since they were violating a law. Common sense tells us they were doing it because they saw it as beneficial.