In cases of emergencies government can and often does intervene (see housing crisis, airlines during covid etc). Why wouldn't government offset something like this in case of student loans during emergencies?
In the end this was a statue (https://en.wikipedia.org/wiki/Higher_Education_Relief_Opport...) Biden was using for loan forgiveness. According to current Supreme Court (at least when Trump is a president) court shouldn't be deciding (in a lot of cases) over executive when its assessment of a situation is correct. However the court did it with Biden.
You're framing it like it's black and white and it's obvious loan forgiveness is wrong/illegal. Nah, it's not obvious, we did have an emergency and it might have needed exceptional solutions to it (in this case with student loans).