I think you're making this more complicated than it needs to be.
Let me set this up by answering two questions that you didn't ask. :-)
- I have cash in a post-tax account that is receiving 0% (or trivial) interest. Should I withdraw from this account to pay for a car or take a loan?
This is a (mostly) easy question. If you buy the car from this account, it costs you $0 on top of the cost of the car, compared to whatever interest you would pay on the loan. Clearly, you save money by withdrawing from this account.
The only caveat would be the possibility that you might need the cash for some emergency, and if that happened that your alternatives at the time would be more expensive than the car loan.
- I have money in a post-tax investment account. Should I withdraw etc?
In this case the question would be what return you are getting on the investment account versus the interest rate on the loan. If the loan will cost you 5% and the investments are returning 6%, you are better off to get the loan. Use the profits on the investments to pay the interest on the loan and you will still be 1% ahead.
The catch to this is that interest on a car loan is usually fixed, while return on investments is highly variable and unpredictable. Historically, the stock market returns an average of 7% per year, so you PROBABLY would be better off to leave the money in your investment account and take the 4% loan. But you can't rely on that. So it becomes a question of how much you want to gamble.
So now to your real question: You have a pre-tax retirement account, etc.
By getting the loan, you have to pay 4% interest.
By withdrawing money from the retirement account, you will: (a) Pay income tax on the amount withdrawn. As you're withdrawing a non-trivial amount of money, this will likely be in a higher tax bracket than you would pay if you withdrew the money at your normal rate. (Whatever that rate may be.) (b) Assuming this does push you into a higher tax bracket, not only will the money withdrawn to buy the car be in the higher bracket, but you may no longer qualify for income-based deductions, etc. (c) You will forfeit the profits you might have made on the investments.
I don't know what tax bracket you're in so I can't calculate the numbers. As I write this the stock market has been in a slide so returns are negative, but who knows what will happen in the next few years? (What's relevant is the period of time that the loan would last.)
Just suppose, to make up numbers, that you are normally paying a 10% marginal tax rate, but withdrawing this additional money will push you into a 12% marginal tax rate. Then you will pay 2% more tax on the money withdrawn then you would if you left it in the account and withdrew it more slowly over a period of years. As I say, I don't know your tax bracket. Looking at 2022 tax brackets, the worst case would be if you're taxable income without this withdrawal was $41,775. Then you'd be paying 12%, but the extra withdrawal would be taxed at 22%, for a 10% extra cost. Depending on just where your numbers land, it might not move you into another tax bracket at all, and so while paying the tax now rather than later may seem painful, the real tax cost is zero. But somewhere between 0% and 10%. Which is quite a range.
If you are already in the top tax bracket and expect to be indefinitely, then the tax implications would be zero. But if you were in the top tax bracket you probably would be asking your team of personal accountants this question rather than a bunch of strangers on the Internet!
The amount withheld when you withdraw the money is mostly irrelevant. If it's more than you owe in tax you're going to get a refund anyway and if it's less you'll have to pay the difference. The only difference it would make is if the calculation is close enough than you're considering how much you might make on investments in the period between when you withdraw the money and when you file your taxes. That is, if the withholding is high, you'll have less cash between the day you pay it and when you file your taxes, which creates some opportunity cost.
Historically the stock market has returned about 7%. If you used that as your benchmark, then even with zero tax cost, you're forfeiting a 7% investment return versus paying 4% interest. Better to pay the interest.
Monthly payments in any scenario are irrelevant. What matters is total cost one way or the other.
So all that said ... I was in exactly the same position a couple of years ago. I wasn't retired yet but I had plenty of cash in an investment account to pay for a car I wanted to buy. So the question was, Do I withdraw from the investment account and pay the opportunity cost of lost returns on investment, or take a loan and pay the interest? I figured, if the average return on my investments is 7%, and Ford was offering me a loan at 3% interest at the time, I was better off to take the loan. If I had been retired and there were tax implications on top of that, that would have been more reason to take the loan.
As I said, there's the uncertainty with investments versus a fixed loan rate, so a cautious person might prefer to pay cash.
Oh, one other thing to consider: The hassle of having to deal with loan payments. It's extra paperwork every month, if you forget to make a payment you could get hit with a late fee, etc.