Assuming the IRS takes the car for non-payment of taxes, who pays off
the car loan? Does the lender get stuck?
The lender does not get stuck.
The U.S. Treasury takes the car subject to the car loan. It then sells the car at auction and keeps as a credit against the taxpayer's tax liability, the money that is left over from the auction sale price after the costs of sale and the payoff of the lender (including any penalties, attorney fees, and default interest accrued).
Usually, the auction price is much less than the fair market value of the car sold by a used car dealer in the ordinary course.
In the facts as given, a sales prices of $7,000-$8,000 might be typical, with costs of sale on the order of $1,000, and a payment $5,000 to the lender once penalties for having the car foreclosed upon are considered, resulting in a net credit against tax liability of $1,000-$2,000.
What If The Auction Sale Price Less Costs Of Sale Doesn't Cover The Entire Car Loan?
If the sale price were insufficient to pay the car loan with all penalties and interest and the costs of sale, the U.S. Treasury would get nothing, and the car loan lender could sue you for the balance which still remains unpaid after the auction, which is called a "deficiency judgment." This would be an open and shut lawsuit, since having the car seized is an event of default and any fault in how the sale was conducted couldn't be attributed to the bank. If the deficiency is small (e.g. $100-$500), the lender might send collection letters, or file a claim in a bankruptcy if there is one, but not bother to sue.
What If The Lender's Lien Wasn't Filed With The DMV?
All of this assumes that the car loan was property documented with a state Department of Motor Vehicles filing. If the loan wasn't properly documented on the certificate of title (or a certificate of title whose issuance is pending), the entire sales price, after the costs of sale, is a credit against taxes owed (probably $6,000-$7,000 in this example). In that case, the foreclosure is still an event of default under the car loan, and the car lender can sue the borrower for the entire amount of the loan plus interest, penalties, and usually attorney fees (probably $6,000 to $7,000 in all in this fact pattern, because a lawsuit has to be begun rather than relying on the IRS to do some of that work).
Also, if that happens, the car lender fires its attorneys and sues them for malpractice if it can't collect the balance it is owed on its car loan. I'm familiar with a case where that happened in a $10 million transaction, for property much more valuable than a used car, and the lender prevailed.