ONE OF THE GREAT PUZZLES of the past year is that the world was devastated by a plague and Massachusetts tax revenues were…pretty much OK. Month after month, the state is collecting far more money than expected, dissolving initial fears of a multi-billion dollar deficit and leading to a new realization that state finances are relatively healthy.

This remarkable turn-of-events raises two fundamental questions. First, how have state tax revenues held up so well amid the lockdowns, joblessness, and main street woes? Second, should experts and policy wonks have foreseen this surprising outcome?

If you’re looking for quick answers, the tl;dr version goes like this: thanks to its mix of revenue sources, the Massachusetts tax system was able to capture the benefits of outsize federal spending and shifting economic activity; and while that was hard to see in advance, we could have done a much better job revising forecasts and updating expectations along the way.

What actually happened?

A year ago, when COVID-19 was first spreading across Massachusetts and we were learning new phrases like “contact tracing” and “flatten the curve,” the Massachusetts Legislature asked various economists and policy groups (including my own) to assess the potential consequences for tax revenues and the state economy more generally.

Nearly everyone at the roundtable expressed dire concern and warned of mammoth uncertainty. Unemployment was going to spike (it did), GDP would collapse (it did), and state tax revenues were likely to crater, just as they had at the nadir of the Great Recession, when Massachusetts had a $3 billion shortfall — followed by another $1.5 billion deficit the following year.

At first, the warnings held true. Between April and June, the state did experience a sizable drop in tax revenue.

But an unexpected thing happened when spring turned to summer and the state’s new fiscal year (FY 2021) began. Monthly reports from the Department of Revenue started showing relatively healthy-looking tax collections. And far from a temporary blip, that overperformance has continued right up to the present.

As of the end of February, Massachusetts is on pace to collect $31.5 billion, vastly more tax revenue than expected — indeed, more than we were collecting before the pandemic struck.

Why did tax revenues remain strong?

There are two main reasons Massachusetts tax revenues have bested expectation: 1) massive economic aid from the federal government; 2) a flexible tax system which allowed us to capture shifting economic activity.

Between stimulus checks, PPP loans, bailouts for hard-hit sectors, public health spending, and a host of other cash infusions, federal aid has helped sustain people’s incomes and encourage spending. And in that way, it also bolstered the state tax system.

Consider the state income tax. For tax purposes, unemployment benefits generally count as income, just like a paycheck. So when the federal government introduced expanded unemployment insurance — with many laid-off workers receiving more money in benefits than they ever received from their jobs — that raised state income tax receipts. (More recently, the state has decided to refund some of these taxes paid on unemployment benefits–not least because other revenue streams are returning.)

Or, think about what people do when they get money from the federal government, be it through unemployment benefits, direct stimulus checks, or a paycheck backstopped by PPP loans. They turn around and spend some of that money at local grocery stores and online marketplaces, which generates sales tax for Massachusetts.

It’s worth noting, though, that we did get lucky here. Had the pandemic hit just a few years ago, sales tax collection might have been hamstrung by the fact that Massachusetts lacked the clear authority to collect taxes from online retailers located in other parts of the country.

However, a landmark Supreme Court ruling in 2018 expanded states’ ability to collect sales taxes from online retailers. And that has proved essential in a pandemic year when so many local storefronts have been shuttered and so much economic activity is happening online.

Why couldn’t we foresee it?

Maybe it’s cold comfort but we were hardly alone in expecting devastating tax shortfalls. States around the country, and national policy groups, all predicted the same thing.

Trouble is, the early pessimism wasn’t just wrong but enduringly so. It was a stake we had put in the ground, and even when monthly updates showed surprisingly strong tax revenues, we still felt tied to that stake.

Perhaps the best example is the notion — heard echoing through the virtual corridors of the State House last fall — that the real challenge was going to be next year (FY22). We had predicted a catastrophe; and if tax collections didn’t actually look catastrophic, that only proved the real emergency was still out there somewhere, waiting to derail us.

There’s also a deeper issue, which is that pessimism is always better than optimism when it comes to budget-making.

If you predict $30 billion in tax revenue and collect $31 billion, that feels like a windfall — free money to spend on new priorities. But it’s a real problem if you expect $30 billion and collect $29 billion. In that case, not only do legislators have to renege on spending promises but they also cede some control, since Massachusetts law gives the governor greater authority over what gets cut.

As a consequence, lawmakers prefer to build budgets with conservative revenue estimates, and then to collect more tax dollars than planned.

There are essentially two ways to handle this: outside groups — like mine — could hedge our projections, giving valuable cover to lawmakers; or we could stick to straight economic modeling and let the politicians make downward adjustments as they construct the budget.

Each approach has benefits, but right now we’ve got a kind of in-between situation where some groups seem to hedge and others (including mine) don’t. The result is a mix of projections that aren’t really apples-to-apples.

How can we do better next time?

In “normal” times, the whole process for estimating tax revenues seems to work pretty well: outside groups make projections, lawmakers split the small differences, and budget-writing begins.

Recessions, pandemics, and economic turning points will always be more fraught, but two lessons of the last year really stand out:

Broad-based tax systems are more robust. It’s helpful that we collect taxes on income, unemployment benefits, capital gains, in-person sales, online sales, and beyond — because it means we don’t lose out when economic activity shifts.

Looking ahead, there are ways the state could further expand its tax base — and make our system more disruption-proof. For instance, taxes on services and digital goods are currently very limited, and a package that raised taxes in these areas — while lowering them in others — could buttress the system as a whole.

Flexibility is extremely valuable. When economists and outside groups were (wrongly) predicting a collapse in tax revenues, they also (rightly) supported a rethinking of the budget-writing process to reflect the high levels of uncertainty.

Breaking from the normal, full-year planning process, and relying instead on short-term spending proposals, gave budget-writers time to realize their early mistake and avoid the kind of drastic cuts that seemed inevitable last spring.

Pretty soon, last year’s deficit fears will seem like ancient history. But when economic uncertainty returns, as we all know it will, I hope we remember some of the lessons of this pandemic year: keep an eye on the feds; slow the process down; don’t expect the next recession to look like the last one.

But I also hope that forecasters — myself included — are quicker to incorporate new information and more ready to regularly share their shifting sense of what’s going on.

Evan Horowitz is the executive director of the Center for State Policy Analysis at Tisch College at Tufts University.