From what I’ve heard this is not legal.
But , to deal with the legalisms, someone would have to pursue this issue in court.
And who knows what would happen in court? Someone somewhere would have to file a lawsuit and claim some harm came to them from the loans being forgiven.
It would not surprise me at all , if a court said any such individual filing such a lawsuit lacked standing, because they were not harmed by this decision.
Leftist state AG's file lawsuits on hypotheticals on behalf of some nebulous, but unnamed, "victim" all the time. They cannot produce a single person who was prevented from voting because of voter ID laws, but the courts hear them anyway and often grant relief, i.e. cancel voter ID laws.