Macy's Inc. has lost a bid to prevent rival J.C. Penney Co. from selling some Martha Stewart-branded products in its stores.

New York State Supreme Court Justice Jeffrey Oing denied Macy's request on Thursday. The judge said J.C. Penney is already abiding by an injunction that prevents it from selling certain Martha Stewart-brand items such as cookware, kitchen utensils, and bed and bath products that fall under an exclusive Macy's contract, Macy's Inc. spokeswoman Sharon Bateman said Friday in an email to The Associated Press.

Last year, J.C. Penney bought a nearly 17 percent stake in Martha Stewart Living Omnimedia Inc. and announced plans to open Martha Stewart mini-shops in its stores starting in February 2013 as part of its efforts to revitalize its business under new CEO Ron Johnson. Imagined as a home-focused "Genius Bar," akin to the technical help Apple Inc. provides in its stores, the Martha Stewart shops are intended to attract customers looking for advice on DIY projects and topics like cooking a complete Thanksgiving dinner.

The move also would help expand the customer base for Martha Stewart Living, which has grappled with declines in print advertising revenue for its magazines and fierce competition from other websites that offer recipes and lifestyle advice.

But the partnership prompted Cincinnati-based Macy's to sue Martha Stewart Living and J.C. Penney. Macy's said that it holds exclusive rights to certain categories of the brand until 2018 and claims that the contract breach could potentially cost it billions in sales. Macy's had sought unspecified damages and an order blocking the deal.

Martha Stewart Living has denied that the deal with Plano, Texas-based Penney violates its existing contract with Macy's. But in July, the court issued an injunction temporarily blocking the sale of certain Martha Stewart products in Penney stores. That injunction is under appeal.

Penney's officials couldn't be immediately reached for comment.

In afternoon trading Macy's shares rose 9 cents at $40.39, while J.C. Penney rose 28 cents, or 1.1 percent, to $26.27 in very light trading. Martha Stewart shares edged up 3 cents to $2.96.