Missing the point. Taxes tend to go into the general fund which pays for general expenses and they never run a surplus. Other funding sources are moved into specific funds earmarked (by law) for specific and limited purposes. No matter how much of a deficit you run in the general fund, you cant take money out of the Mickey Mouse fund to cover general expenses. The Mickey Mouse fund can only be used to send elected officials to Disney World.
Since people only visit Disney World every 5 years, you invest your Mickey Mouse fund funds until you need them.
I live in a small town and we have 10s of different funds that have limited specific purposes. The John Q Smith fund to be used to pay for one $500 scholarship to the graduating senior with the most common last name to make up an absurd example. Any fund like this has essentially a large principal that never gets touched and the proceeds get used for some specific purpose. The principal is invested. The fund is controlled by the government who is limited in its use to its stated purpose.
You can donate $1B to your local government and tell them what it can be used for. They manage the money and spend it within your stated purpose. A lot of funds like this got setup in people's wills. The town/state will go to probate occasionally to get terms modified as the original purpose no longer is legal/makes-sense/is-possible, etc. A fund for white boys to go to KKK training in the Republic of Texas, for example, would have multiple issues honoring.
All said, the government has LOTS of money to invest that they cant use for raise and appropriate items like the general fund.
While this is not civics 101, its not more than civics 201.