It depends on the state. In many states, the bank can pursue you for any deficiency after a foreclosure, so there is a real risk in "mailing the keys back" and just walking away. In those cases, a negotiated settlement is essential.
In some states, such as in Arizona and California, the banks have no recourse for a purchase money loan - their only option is to foreclose and they cannot pursue any deficiency. So in those cases, while their credit would be damaged for a few years, there is no hidden financial risk. With the current tax laws exempting debt forgiven as result of a foreclosure, in these states you can literally mail back the keys and walk away with no further liability.
Even in the case of recourse loans - non-purchase money loans such as a refinance with cash out - the bank has limited options in California. There is a 1-action rule here - the bank can pursue a judicial foreclosure or a non-judicial foreclosure (trustee sale). If they choose a trustee sale (the option selected in 99%+ of foreclosures), they cannot pursue a deficiency, even if the loan is a recourse loan. They rarely pursue judicial foreclosures unless the borrower has a lot of other assets because they are more expensive, take a long time, allow the borrower up to a year after the foreclosure to redeem the property (meaning the property cannot be sold during that time), and the borrower always has the opportunity to claim bankruptcy to eliminate any deficiency.
Wow - now I understand why businesses are leaving California in droves.