(Reuters) -- Martha Stewart Living Omnimedia's contract with Macy's to exclusively sell certain products has a loophole that will let the company sell in J.C. Penney Co stores, according to the home-goods company.

The loophole is that the company can sell any product from a Martha Stewart Living Store, the company said.

J.C. Penney in December took nearly a 17 percent stake in Martha Stewart Living and announced plans to open shops within its stores that sell Martha Stewart-branded goods, starting in 2013.

Macy's sued Martha Stewart Living, accusing the company of breach of contract for entering the agreement with Plano, Texas-based J.C. Penney.

Macy's claims Martha Stewart Living granted it the exclusive right to manufacture and sell the Stewart-branded goods in Macy's lines under a 2006 agreement that, with a renewal, runs until 2018.

Macy's is seeking a preliminary injunction to stop Martha Stewart from taking any action to implement its deal with J.C. Penney to prevent irreparable injury to Macy's.

Billions of dollars of sales are involved, Macy's said in its February 1 complaint, filed in New York state Supreme Court in Manhattan.

According to the lawsuit, Martha Stewart Living confirmed at a December 15 meeting that the planned Martha Stewart stores within J.C. Penney would be operated by J.C. Penney employees and that all sales would be made by J.C. Penney.

The lawsuit was filed with certain information redacted, including what the Martha Stewart Collection generates in net sales at Macy's.

Macy's said Martha Stewart compounds the injury by entering into the agreement with J.C. Penney, which it describes as a less upscale retailer.

We value our relationship with Macy's and are confident that we are not breaching the terms of our agreement, Martha Stewart Living said in a statement.

MSLO believes it's good for our partners, our consumers and our brand to have a wide range of Martha Stewart products available in a wide variety of top retailers, the statement said.

J.C. Penney's and Macy's did not immediately respond to requests for comment.

The case is Macy's Inc. v. Martha Stewart Living Omnimedia, Inc., 650197/2012, New York state Supreme Court (Manhattan).

(Reporting By Karen Freifeld; editing by Carol Bishopric)