Marriage isn't just a legal, religious, or cultural institution — it's also a fiscal one, with big ramifications for the way that the government taxes ordinary Americans and spends money to support them. As gay marriage has spread on the state level, economists have begun to measure its impact on the government's coffers.

It's an inherently tricky thing to measure, requiring researchers to estimate how many same-sex couples will actually decide to marry and how much each spouse is likely to earn. Legislators have also made big fiscal decisions in recent years — most recently preserving the majority of the Bush tax cuts — that the earlier research didn't anticipate.

That said, most of the research to date suggests that legalizing gay marriage would have a positive net impact on government revenues, thus helping to decrease the deficit.

There are two major ways that increasing gay marriage — and, for that matter, any kind of marriage — would affect the budget. First, it would likely reduce dependence on public benefits, not just because married couples are more likely to support each other financially but also because of how benefits change according to one's legal marital status.

"Marriage in most states creates a mutual support obligation. That takes up a lot of the slack for taking care of an individual, if he loses a job, gets sick, built into our public assistance system," says economist Lee Badgett, a professor at the University of Massachusetts-Amherst.

Back in 2004, the Congressional Budget Office calculated that legalizing gay marriage in all 50 states would reduce government spending on Supplemental Security Income (means-tested payments to low-income elderly and disabled), Medicaid and Medicare, while it would increase spending on federal employees' health benefits, which same-sex partners and spouses currently don't receive. The net impact would vary in the short term but it would be positive in the longer term, CBO concludes: "recognizing same-sex marriages would affect outlays by less than $50 million a year in either direction through 2009 and reduce them by about $100 million to $200 million annually from 2010 through 2014."

Studies showed that gay marriage would have a similar impact on state budgets: Josh Barro points to 2009 study from UCLA's Williams Institute, co-authored by Badgett, which showed that legalizing gay marriage in Maine would have reduced its 2006 spending on same-sex couples from an estimated $22,135,835 to $7,326,828 because of lower outlays for Supplemental Security Income, state-run health care, and welfare benefits. A 2011 Williams Institute study similarly found that gay marriage in Rhode Island would save the state $406,722 over three years in public assistance spending.

Legalizing gay marriage would also change the way that the government collects taxes on gay couples. But the overall fiscal impact would likely be smaller as some couples would pay less in taxes while others would pay more due to the so-called "marriage penalty" — an idiosyncrasy in the tax code that penalizes relatively well-off couples where both spouses earn comparable salaries.

Overall, the CBO estimated that income tax revenue to the government would increase if gay marriage were legalized. While revenue from taxing estates and transfers of property would decrease, the tax changes overall would generate between $200 million and $400 million each year, the CBO concludes. (The report estimated that would jump to $500 million to $700 million a year if the Bush tax cuts expired.) University of Michigan economist Adam Stevenson concluded in a 2012 study that the tax revenue generated would be significantly smaller — on the order of $20 million to $40 million annually — partly because some gay spouses would change their working hours and labor force participation in response to the marriage penalty. But Stevenson agrees overall that "the net federal budgetary effects remain positive under any reasonable set of economic assumptions."

The revenue change would have a similar impact on the state level, where gay marriage would also provide a major short-term bump through marriage license fees and sales tax revenue from wedding expenses. "Gay couples lobbying for marriage equality are, on average, lobbying to be given the right to pay more in taxes," says Justin Wolfers, an economist at the University of Michigan.

Taken as a whole, the fiscal impact of gay marriage is positive, though relatively small in the scheme of things: The CBO's 2004 study estimated that legalizing marriage nationwide would generate less than $1 billion in net revenue over 10 years (though it assumed the Bush tax cuts would expire in 2010, so that estimate would be significantly smaller under the current baseline ). The Maine study estimated that it would boost the state's coffers by $7.9 million in the first three years, and it would raise about $1.2 million in net revenue for Rhode Island. So for those hoping to restrain entitlement spending and raise more tax revenues, gay marriage is a good deal.