Obviously, if the government could be metaphysically certain of the loans that would never return another penny and only cancel those, there's no net loss to the bank. But there's no net gain to the borrower other than a potential psychological effect.
Risk of government-sanctioned default is the same as any other default risk, and will be priced into interest rates, hurting especially those with marginal credit whom the banks judge most likely to be the "beneficiaries" of some future forgiveness.