Bill Gates is required by law to give away 5% of equity in his foundation every year otherwise he would lose charitable tax-exempt status from IRS... so yes, he gave away billions but at the same he avoided to pay billions in taxes to government by funneling most of his wealth into his foundation.
So the whole comparison between him and the government is pointless since it's the government that made it possible for Bill Gates to even do charity at this scale by sacrificing its own tax revenue.
So the whole comparison between him and the government is pointless since it's the government that made it possible for Bill Gates to even do charity at this scale by sacrificing its own tax revenue.