Two months after the Supreme Court struck down the Defense of Marriage Act, the Treasury Department on Thursday ruled that legally married same-sex couples will be treated as married for federal tax purposes.

The decision has a host of implications, even for same-sex married couples who now live in states that don't recognize same-sex marriage.

It affects how they will be treated in terms of federal income taxes, federal estate and gift taxes, the tax breaks they get for employer-sponsored health insurance and other benefits.

(Full coverage of LGBT financial issues)

The ruling applies to any same-sex couple legally married in any state, the District of Columbia, a U.S. territory or foreign country. It does not apply to registered domestic partnerships, civil unions or other formal relationships recognized under state laws.

Currently 13 states and D.C. have legalized same-sex marriage as have 15 other countries, including the Netherlands, Belgium, Spain, Canada, Sweden, South Africa and Brazil.

(Related: Experts answer same-sex marriage questions)

"Today's ruling provides certainty and clear, coherent tax filing guidance for all legally married same-sex couples nationwide," Treasury Secretary Jack Lew said in a statement. "It provides access to benefits, responsibilities and protections under federal tax law that all Americans deserve."

Practically speaking, in terms of filing their 2013 federal taxes, legally married same-sex couples must choose to file either as "married filing jointly" or "married filing separately."

They may also choose to file an amended return as a married couple and a refund claim for tax years 2010, 2011 and 2012.

(Map: Where same-sex marriage is legal)

In terms of health insurance, until now money used to buy same-sex spousal coverage in an employer-sponsored plan was subject to income tax. Now, as a result of Treasury's ruling, that money will be treated as tax free for federal income tax purposes. And the participating employee can file a refund claim for the income taxes paid on those spousal coverage premiums.

The federal estate tax will also offer more favorable treatment. Same-sex surviving spouses will now be entitled to inherit the estate of their late husband or wife tax-free.

But it may not be all good news and savings.

Some legally married same-sex couples, like their opposite-sex counterparts, will find themselves subject to the notorious marriage penalty. That refers to situations where a married couple ends up with a higher tax bill as a result of filing jointly than when they filed as single people making the same income.

(For more information, here's an IRS FAQ on the same sex marriage ruling.)