It’s not quite as simple as the government doing the donation. If you donate 1000 dollars that is tax deductible and your marginal tax rate is 36% that means the government is out $360 dollars. It’s not a tax credit it just adjusts you taxable income.
Now back in the day when we had a top Marginal rate of 90% or more you can see why folks would be more inclined to do these huge charity/vanity projects.
Lot more useful than sending your car to orbit Mars but probably the same goal.