I’ll agree that - if the terms of extricating yourself from the mortgage are spelled out in the loan agreement, and one option is “turning in the keys”, then it’s ethical.
however, as others have pointed out - in many jurisdictions, if you are foreclosed on, likely your agreement and state law allows the bank to sue you for the difference or sell that liability to a third party who will then harass you. In that case, you have traded “a property and a debt” for “no property, rent payments, and a less definite and smaller debt”. Depending on what rents are in your neighbourhood, this may or may not be a financially sound move.
Is it ethical? IMHO - Depends how you play it out. Legal does not equal ethical, just ask a lawyer… Ethical suggests you notify anyone who has played fair with you up to now, what your intentions and plans are. I would suggest that it IS ethical to retaliate, to not be forthright with those who do not treat you ethically.
However, in general, if you plan to turn in the keys, tell the bank so rather than letting them send unanswered letters for a few months’ free rent until the process reaches foreclosure. Exploiting a loophole to get free use of a house you should and could be paying for, is unethical.
I would argue ethic turns on intent too, IMHO. For example, buying something to use for a week or two then returning it is unethical - if you intended to do so. Buying something, finding that is not what you wanted and does not do what you expected (even though it is not defective) is ethical and something many people do normally. Using that item heavily then returning is not ethical. Using the item to truly see if it satisfactory, then stop using it once you determine it is unsatisfactory, and then returning it, is ethical. The key is intent; only you know your intent, so ethics is internal. In all above examples the action is legal if the merchant has a return policty.
And yes, the world is full of @$$h**es who take a free ride on the fact that merchants allow this crap and most people are too honest to exploit the loopholes.