Medical expenses are only deductible once you've exceeded a certain percentage of your income. I've never been able to deduct anything substantial, and I've had some pretty outrageous medical bills. (Cancer survivor.) And that phrase "to the extent" reads to me like it means any amount forgiven that doesn't meet the threshold is considered income.
One year I was billed $40k for radiation. You know, a thing I needed or else I would've died. I managed to negotiate that down to $25k. (While having cancer!) You'd think that would meet the threshold for deduction, but there's a catch: you can't deduct the bill, you can only deduct what you've actually paid. So if you do a payment plan, which of course I did because how the hell else was I going to pay that, now that bill is spread out too much to be eligible for deduction.
The US medical system is fucked, full stop. We wouldn't tolerate someone holding a gun to your head and saying "I'll put the gun away for $40k." And if you do manage to get treatment, now you're trapped in a game with rules only slightly more complicated than Dungeons & Dragons - and the DM is a sociopath.