Editor's Note: This article is part of our 2014 Tax Tips series. Robert Flach is an expert with more than 40 years of experience as a tax professional and also blogs as The Wandering Tax Pro.

NEW YORK (MainStreet) — The Internal Revenue Service has ruled that a same-sex couple legally married in a state that recognizes same-sex marriages will be treated as married for federal tax purposes. The ruling applies regardless of whether the couple lives in a state that recognizes same-sex marriage or one that does not.

The "state of celebration" determines the federal tax treatment and not the state of residence. Legally married same-sex couples can move freely throughout the U.S., from state to state, and their federal filing status will not change.

What does this mean?

Same-sex couples who were legally married in a state that permits same-sex marriages, and are still legally married on December 31, 2013, must file their 2013 federal income tax return(s) as either Married Filing Jointly or Married Filing Separately. This is true regardless of their state of residence.

If a same-sex couple participated in a marriage ceremony in a state that does not recognize same-sex marriages, or have entered into a registered domestic partnership, civil union, or similar formal relationship, whether or not recognized under state law, the couple must continue to file 2013 federal income tax returns as two single, unmarried, individuals.

How the couple will file their state income tax return(s) depends on the laws of their state of residence. If their state recognizes same-sex marriages they will file both federal and state returns as married. If their state does not recognize such marriages they will file a federal return as married and state returns as two single, unmarried, individuals.

Here is an example.

My home state of Pennsylvania does not recognize same-sex marriages, civil unions or domestic partnerships.

A Pennsylvania resident same-sex couple getting a marriage certificate from New York would be considered married for federal tax purposes because they hold a marriage license that is valid in the state in which they received it. They would be required to file their 2013 federal tax return as married. But, as Pennsylvania does not allow same-sex marriages, each member of the couple must file a separate Form PA-40 as Single taxpayer.

--Written by Robert D. Flach for MainStreet