Any loan whose proceeds were used to pay the purchase price of an owner-occupied property is a non-recourse loan. This applies to all loans, including 2nd mortgages and so-called “piggyback” loans, even if they are termed a HELOC.
There is good CA case law suggesting that a no-cash-out refi of a purchase money loan is also non-recourse. In this circumstance, however, any loan provisions regarding recourse may be applicable. I haven’t looked deeper into whether such a refi is non-recourse regardless of loan doc language (as it is with true purchase money loans) or whether in a refi the lender can contract around the non-recourse status (which they cannot do with a true purchase money loan)
In the original example provided it’s pretty clear that this homeowner can walk with no recourse and no tax liability, just the credit ding.