In my limited experience, yes, car dealers prefer to loan money rather than have a cash sale. Last car we bought was six years ago, and we definitely found that they were less interested in us once we said, "We're paying cash."
My best advice on car buying:
Do not mix test drives and money discussions. Do your research, test drive, whatever. But when you're ready to buy, come back and tell them, "I want to talk money about ____ car." This is harder with used cars, but at big places like CarMax, it's possible. Don't mix the decision-making process and the emotional desire to own the car with the financial discussion. This also throws the salesmen off their game.
Tell them that you want to talk about one number, one number only: The total, out-the-door cost of the car. Include taxes, fees, whatever. This prevents them from adding on a bunch of money at the end, after you thought you were "done". The salesmen hate this and will fight you on it. They will constantly return to, "This feature is only X amount more per month." Firmly but politely return to, "I want to talk about one number only: The total, out-the-door cost of the car." No matter how many times they try to distract you with other questions, return to that one number.
Refuse to discuss financing. When they ask how you're going to pay, respond with a vague, "I'm not ready to make that decision. What I need to know today is the total, out-the-door cost of the car."
Do not trade your car when you buy a new one. Make it two separate transactions. The simpler your transaction, the more transparent the numbers. The salesmen like to include trades and lots of complicated numbers -- it confuses people, and they go away not knowing what they're really paid.
They do this all day, every day. If you allow them to start flipping around trade-ins, financing costs, etc., etc., etc., they will beat you. So refuse to play their game. Total, out-the-door cost. Nothing else.
Once you have the price you're willing to pay, THEN tell them you're going to pay cash.
This method has worked great for us.