It's because when you buy it, the car is new and the engine is not broken in. But, when you win the same car in a race, it's engine has already been broken in, therefore having more horsepower.
If you don't believe me, go buy a car, give it an oil change. Race it for a little while, give it another oil change when you go back. The car shouldv'e increased in HP.