The game makers pay for racing games, or at least work out deals regarding marketing etc. I've read that car companies also care a lot about the presentation in-game, so e.g. games with real cars can't have extreme damage models because many companies don't want horribly wrecked versions of their cars to be shown.