Gap insurance pays for the difference. However, if you consider that a replacement car of the same model and quality is the market price, your loss is already there when you buy a car that reduces its value faster than your loan payment. You lose value in per month depreciation even if you pay cash. That's regardless of loan or not.If the car is totalled, the bank eats the loan without impact to my finances or credit. If I paid cash, and had full coverage, Id just get a check for appraised value.
I think the moral of the story, to me, is to buy a car that depreciate less, if possible. It is how it should be done unless the manufacturer lease you a car with fake residual value and they have to eat it, or they mess with the residual to give you a good loan.
Every car depreciate differently, and it is not just EV. For EV we know battery depreciate and therefore the car depreciate, and therefore we need to remember it is the real cost for EV (the battery depreciation must be factored in along with electricity cost, like a gasoline car with a known problematic transmission must factor in the tranny rebuild cost).
Those who buy an EV and rarely drives it will not save money because battery still depreciate, therefore the EV depreciate.