You have an eye for automobile performance.
According to the film's stunt coordinators, Brad Martin, what you saw on screen, part of the time at least, was a Prius frame with a completely different car underneath.
He was interviewed for a "Wall Street Journal" article that calls the Prius the "unsung hero" of the buddy-cop comedy. Its presence in the film is essentially a running joke -- the sensible, environmentally friendly car is driven by Will Ferrell's character, who is supposed to be a sensible, square desk jockey, as a contrast to his tough and wild partner, played by Mark Wahlberg.
According to the article, the film used three different Prius cars, two more or less from the factory and one rebuilt like a rally-race car. Among the custom features was, as you point out, rear-wheel drive.
According to the article, the engine on the racing version was so big it couldn't fit under the Prius's hood, and so had to be installed in the back seat.
Martin said that his stunt people had a good time with the secret sports car.
"It took three days to really get familiar with the rally car, but once the stunt drivers got used to the snappiness, it was a lot of fun to drive."
Have a question? Email us at firstname.lastname@example.org. Please include your name and town. Personal replies will not be provided.