That doesn't really address the "if you are buying the vehicle anyway" absolute angle though.
Let's say we are talking about a retiree that has just driven their vehicle for 25 years and now needs to buy a new vehicle. Their monthly income, including investment revenue is $12,500. They can either dip into their investments, pull out the $100K, that is making money, or, they can finance the vehicle. Assuming the interest rate is extremely low (0%, 0.99%...etc), and what the market is paying them on their investment, it's the better option to take the loan, because they don't reduce the size of their investment.
Yes, there's depreciation and all that to consider as to the "real cost", but in terms of the impact on their investment, reducing its size to pay for the vehicle, vs using the return to pay for the vehicle, the latter is the smarter choice.