If Mitchell and Cameron of TV’s “Modern Family” lived in the real world, they would be scratching their heads over the confusing welter of laws faced by families headed by gay couples. But when they sit down with their accountant, they might be grinning because these conflicting laws can provide gay and lesbian parents with a big break on their income taxes.

“Sometimes same-sex couples with children have an advantage,” says Tina Salandra, whose New York City accounting firm, Numerical, specializes in taxes for gays and lesbians.

Federal gay marriage ban complicates things

Like hundreds of thousands of other same-sex couples, Mitchell and Cameron are raising a child. In their fictional case, they have an adopted daughter from Vietnam named Lily and are considering adopting a second child.

In real life, same-sex couples with kids have to deal with financial and legal confusion primarily created by the Defense of Marriage Act, a 1996 law that prohibits the federal government from recognizing same-sex marriages, according to accountants and tax attorneys. Though state laws allow same-sex couples to marry legally in a growing number of places — currently Massachusetts, Iowa, Vermont, Connecticut, New Hampshire, New York, Washington, D.C., and Washington state — the Internal Revenue Service has to treat same-sex spouses as if they were strangers. (Maryland will join the same-sex marriage states when a new law takes effect in January 2013.)

Among many other things, the federal law bars legally married same-sex couples from receiving the same Social Security and federal pension benefits that married heterosexuals can. Same-sex spouses also pay taxes on health insurance benefits and gifts that married heterosexuals never pay.

However, the law may sometimes cut gay families a few breaks. The biggest can come from the fact that legally married same-sex couples are prohibited from filing their taxes jointly.

“Because gay couples cannot file a joint (federal) return, they are not subject to the ‘marriage penalty,'” Salandra says.

Married heterosexuals can be subject to a higher tax rate than single taxpayers because their combined income can push them into a higher tax bracket. Heterosexual married couples do not have to opt for the convenience of filing jointly. But even if they claim the status of married-filing-separately, they may still pay higher taxes because they fall into different, more demanding tax brackets than single taxpayers.

Head of household: Boon for gay parents?

Gay and lesbian parents can reduce their taxes in even more ways, Salandra says.

If one parent provides more than 50 percent of a child’s financial support, that parent can claim head-of-household filing status and get a higher standard deduction and lower tax rate than single taxpayers. In a same-sex household with two or more children, each partner may be able to claim head-of-household status.

However, the IRS has been challenging these kinds of filings recently, says Wendy Hartmann, a tax and estate attorney with the Los Angeles firm of Bennett & Erdman. Couples contemplating this sort of move should contact their tax advisers.

Head-of-household filing status not only gives same-sex couples filing as singles a lower tax rate, it also can allow them to take greater advantage of child tax credits than married heterosexuals filing jointly.

If the same-sex couple has two or more children and if both partners file as head of household, they may both be able to get the child credit. But Hartmann warns that the IRS also has been frowning on these kinds of filings recently.

A tax break for same-sex couples who adopt

Gay and lesbian parents who adopt may enjoy an additional tax benefit. When they file their returns for 2012, taxpayers who qualify will be able to claim a credit of up to $12,650 for adoption expenses for each eligible child. However, this credit will begin to phase out when taxpayers’ adjusted gross incomes top $189,710.

Married heterosexuals who each make $95,000 and who file jointly would not qualify for the full adoption credit because their combined income of $190,000 is over the limit. But a same-sex couple with similar incomes would qualify because each partner would be below the phaseout level.

In the same way, the single filing status of gay and lesbian parents may help them take greater advantage of education credits than married heterosexuals. These credits support taxpayers who pay for their children’s higher education. One such credit, the American opportunity tax credit, provides a tax break of up to $2,500 per child per year.

The special case in 3 western states

Same-sex parents in California, Nevada and Washington need to take extra care with their taxes, Hartmann says.

In 2010, the IRS declared that registered domestic partners and legally married same-sex couples in those three states must split their income evenly. The ruling applies only to California, Nevada and Washington because they are the only states that combine robust community property laws with legal recognition of same-sex couples.

If both members of a couple have to split income 50-50 on their tax returns, then neither spouse can claim to be providing 51 percent of a child’s support, which means that neither can file as a head of household, Hartmann says.

At the same time, same-sex couples where one partner stays at home and the other works may be able to see big tax savings because of the IRS ruling, she says.

Gay couples may require expert tax help

The best advice Hartmann and Salandra say they can give to gay and lesbian parents, no matter where they live, is to pay close attention to financial planning and taxes. The laws governing same-sex couples are changing quickly, and IRS rules, such as those governing heads of household, continue to be reinterpreted.

Above all, these experts say, gay couples should do research, seek a knowledgeable tax adviser, and remember that the real world can be a lot tougher than the laugh-a-minute life Mitchell and Cameron face on TV.