The site we now know as the Temple Mount in Jerusalem was once a threshing floor. David offered to buy it from its owner, Araunah, who was prepared to give the property and whatever was needed for burnt offerings for the king.
1 Chronicles 21:24 But King David replied to Araunah, ‘No, I insist on buying it for the full price. I will not take what is yours and give it to the Lord. I will not present burnt offerings that have cost me nothing!’
Once it was used as an altar, it was also unlikely the place could have ever been used as a threshing floor again.
Although God had given him the title of king, David had to fight for it every step of the way. In fact, the only thing David ever took that wasn’t his was Bathsheba, and that didn’t work out too well. The experience would have had to have humbled him, and you can see that in his comments as he fled at the start of Absalom’s rebellion.
So by the time it came to sacrificing burnt offerings and peace offerings, David knew he had to pay for the materials.