Mark Zuckerberg was either very lucky or got very good tax advice earlier this year when Facebook went public the day before he married his longtime girlfriend, Priscilla Chan.

Under California’s law, Zuckerberg’s ownership stake in the popular social media site is his alone since the initial public offering occurred while he was still a bachelor.

California is one of nine community property states. The others are Arizona, Idaho, Louisiana, Nevada, New Mexico, Texas, Washington and Wisconsin.

Although each state’s law is slightly different, the general rule is that anything you bring to a marriage is your separate property, and anything acquired by either partner after marriage belongs equally to husband and wife as community property. Exceptions typically are made to allow spouses to separately retain property that is specifically given to each as a gift or inheritance.

This “what’s yours is mine” post-wedding ownership approach affects not only income, real property holdings and investment earnings, but it also could make a difference in federal tax filings and, if things don’t work out, divorce settlements.

Say it ‘taint’ so

While it might seem simple to keep property separate, real-life actions and transactions can muddy the situation.

“You can have separate property and it can change forms,” says David Rosenhouse, CPA and principal of Rosenhouse Group PC in Dallas. “Say you came into a marriage owning shares of IBM in a brokerage account that was in your separate name. You could sell those shares and buy Apple shares with the proceeds that still are separate property.”

But if you moved those IBM shares into a joint brokerage account you hold with your spouse and then sold them and used that community property money to buy Apple shares, you have now, in legal terms, tainted the separate property, says Rosenhouse. The new stock purchase has in effect become community property.

“The best thing to do if you want to maintain separate property is to maintain separate property,” says Rosenhouse.

That’s not always easy to do, but you can help preserve an asset’s separate status by keeping good records, says Leslie Dawson, CPA and partner at Glenn Dawson and Burak LLP in Walnut Creek, Calif. The documentation must be very good, says Dawson, because courts and laws favor equal ownership. “If there’s any doubt, the community wins,” she says.

Or you could have a prenuptial or postnuptial agreement in which both spouses specifically agree that assets that otherwise would be considered community property are separately owned by one or the other.

Uncommon, but possibly costly, tax effects

When it comes to taxes, a happily married couple in every state probably files a joint tax return. Joint filing typically produces a better tax outcome for the couples, and community property laws aren’t a factor with joint filings.

If, however, you and your spouse decide to submit separate Form 1040s, look out.

“Filing separately is a miserable way to file,” says Dawson, “and it’s more miserable in a community property state.”

That’s because the Internal Revenue Service defers to community property law. So you must report not just your legally separate earnings, but also half of all community income on your separate federal tax returns.

So a wife making just a few thousand dollars from a separate account has to report half of her husband’s $100,000 salary, too. Outside of a community property state, each spouse lists earnings separately on these forms, often to benefit from otherwise elusive deductions such as medical expenses that must exceed a certain threshold. The requirement to add a spouse’s earnings could defeat that purpose and could change a community property couple’s mind about filing separate returns.

Divorce difficulties

Community property becomes more of an issue when marital bliss turns to discord.

In California, the date of separation is the time when the community earnings period stops, says Dawson. That can help ease individual federal tax filings during the divorce proceedings.

Texas, however, does not have legal separation, says Rosenhouse, so the joint earnings are not so easily resolved. “If it’s a bloody divorce, community property will be a contentious argument,” he says. “You have a divorcing couple that wants to file separately and must legally report 50 percent of spousal income. If the divorce is contentious, neither wants to give the other records of income.”

There’s also the issue of honest mistakes. When the parting husband and wife don’t understand how state community property laws apply to federal tax filings, says Rosenhouse, a lot of people file their IRS returns improperly.

And, says Dawson, inconsistently filed returns by divorcing couples are likely to get both ex-spouses audited.

Always separate for same-sex couples

Same-sex couples in California, Nevada and Washington also must deal with community property implications in filing their federal tax returns. These three states recognize registered domestic partnerships. Some California couples also were married during the few months in 2008 that same-sex weddings were legal in the Golden State.

Since the federal government does not recognize state-approved same-sex marriages, couples in these three states must file separate federal returns as single taxpayers or, if they have dependent children, as head of household. However, the IRS continues to require the partners to follow their states’ community property laws in filling out the separate federal returns.

As with husband-wife separate filers, same-sex partners must each report half the combined community income earned by both, as well as any separate income. Depending on the couple’s circumstances, the federal tax result could be better or worse.

The IRS covers this and other community filing issues for same-sex couples in Publication 555 and the document on its website titled “Questions and Answers for Registered Domestic Partners and Same-Sex Spouses in Community Property States.”