Facebook and Zynga are the defendants in a federal class-action lawsuit filed Tuesday, which seeks upwards of $5 million for social network users scammed in online game ads. Neither company's top-drawer investors can be happy.

The suit was probably inevitable. As we first reported, the Sacramento-based firm of Kershaw, Cutter & Ratinoff has been looking for victims of scammy ads in games like Mafia Wars and Farmville to potentially file a class action suit. Less than a week later, the firm's suit has hit federal district court in Northern California.

You can read the initial complaint in full here.

Neither gaming startup Zynga nor social network Facebook actually originates the advertisements in question; instead, other companies take out ads in Zynga's games, which run on Facebook's network, and the two companies make reportedly large sums of money from the offers. Some of the ads trick users into signing up for unauthorized cell phone charges or expensive mail-order products like educational CDs, typically by disguising them as "free" offers or "free trials," or as part of an "online quiz." TechCrunch has run an aggressive series of articles, cataloged at the bottom of this post.

Zynga reportedly takes in close to one-third of its revenue from "commercial offers" like those, and Facebook does well too, as KC&R lawyers point out in their complaint. An excerpt (click to enlarge):

Swift's attorneys also point to Zynga CEO Mark Pincus' damning video confession that "I did every horrible thing in the book just to get revenues" in their complaint, indicating it will be a significant piece of courtroom evidence, just as we predicted.

The prospect of being on the hook for massive damages has to make both Zynga and Facebook's investors sweat. Facebook is the darling of Silicon Valley, with VCs having valued it in the billions of dollars, while Zynga counts the elite firm of Kleiner Perkins Caufield & Byers among its major investors. Yet both companies have come to rely on greasy advertisers for much of their revenue; in addition to the game-ad scammers, Facebook is also sells ad to marketers who resort to tactics like using stolen pictures of apparent underaged girls to promote their products. If the company's are found to be liable of helping con customers by working with these sorts of slimeballs, it's hard to say where the payouts might end.

Below, an excerpt of the scams allegedly perpetrated on the lead plaintiff in the case, Rebecca Swift.

(Top pic: Facebook CEO Mark Zuckerberg, by Raphaël Labbé)

[Full court filing]