I don’t know much about it, but they definitely checked my credit score when I bought my last car.
Even if you're paying in cash for a car, an automotive dealership will want to run your credit. They make quite a bit of money from lending money to others. Really the banks give car dealers kickbacks for the loans they deliver to the bank for sold cars.
In essence, if you buy a car in cash, you're denying the car dealer a chance to make a lot of money off the sale. They don't like that. They will do their best to try to sell you on a loan for your car even if you don't want it. That's why they ran your credit.