The Department of Revenue is still counting, but the budget watchers at the Massachusetts Taxpayers Foundation expect that the Legislature will have a surplus of $3.6 billion when the final accounting of the fiscal year that ended last week is complete.

Through May, the state had collected $36.969 billion in tax revenue for fiscal year 2022 — $2.666 billion or 7.8 percent ahead of expectations. Combined with two upgrades the executive branch made during the budget year, MTF said Massachusetts is $5.932 billion ahead of benchmark.

But that's not the anticipated surplus. Supplemental spending has wiped out about $1.6 billion of the overage, about $1.2 billion in above-benchmark capital gains will be statutorily bound for reserves and more than $250 million is due to the School Building Authority and MBTA. When all is said and done, including accounting for an addition $750 million in federal revenue, MTF said it anticipates the final FY2022 surplus will be roughly $3.588 billion, which it notes would be more than twice as large as the roughly $1.5 billion surplus of fiscal year 2021.

"The primary reason the surplus is larger this year is because the original FY 2021 budget relied on close to $2 billion in one-time resources, including the Stabilization Fund. Much of last year's excess tax revenue was used to eliminate the need for these temporary revenues. The original FY 2022 budget did not rely on the Stabilization Fund or other one-time resources, freeing up excess tax revenues for the surplus," MTF wrote in its brief.

The organization pointed out four things that could change its calculations: if June revenues come in above the $3.363 billion benchmark, the surplus will increase; a greater amount of above-benchmark capital gains would divert more to the state's rainy day fund; an updated view of outstanding account deficiencies could eat away at some of the surplus; and significant reversions, or appropriated funds that go unspent, could increase the surplus.

"The FY 2022 budget surplus will be historic and it will require careful planning to use it effectively and sustainably," MTF said.

In addition to any FY2022 surplus, the Legislature also has $2.3 billion in unspent American Rescue Plan Act money at its disposal and is expecting that the state will collect at least $36.915 billion in tax revenue in fiscal year 2023, which began July 1.