Like seeing a horse named Paste winning the Kentucky Derby, J.C. Penney (NYSE:JCP) surprised everyone yesterday by winning one of the little battles in its ongoing war with Macy's (NYSE:M). On Friday, a judge ruled that the struggling retailer could sell its Martha Stewart Living (NYSE:MSO)-designed -- but not Martha Stewart-branded -- merchandise while its legal proceedings continue to unfold. The good news came the day after J.C. Penney failed to have the case thrown out .

The twist in Friday's ruling was that J.C. Penney will be allowed only to sell the items presented under the J.C. Penney Everyday brand, not those labeled as Martha Stewart designs. The ruling seemed, at least in part, to stem from Judge Jeffery Oing's sympathy for J.C. Penney's plight, and his belief that the company is where it is because of former CEO Ron Johnson's meddling.

What's on the line
The ruling was a breath of fresh air for J.C. Penney, which is sitting on an estimated $100 million worth of inventory that it's been unable to sell. J.C. Penney argues that even if it can't sell Martha Stewart-branded merchandise in its shop-within-a-store concepts, it should be allowed to sell non-branded merchandise. That's a claim Macy's clearly disputes, arguing that the exclusivity of its agreement with Stewart prohibits the company from selling in any other stores, period.

As things stand, the shop idea may go out the window with Johnson's departure. That would leave J.C. Penney with Everyday-branded merchandise as its only real avenue to Martha Stewart products.

J.C. Penney on the ropes
The market was unimpressed by the ruling, and J.C. Penney's stock fell slightly on the day. The company is now reportedly looking for new ways to raise some cash to get it through the downturn. The company has received interest from private-equity firms, according to The Wall Street Journal, and has retained Blackstone Group to help it sort things out. 

Other analysts have theorized that the company may sell itself off, or at least a piece of itself, to stay alive. While the company is currently sitting on a decent pile of cash and very little immediate debt, that situation is changing quickly. J.C. Penney is burning through cash, because of a decrease in sales, and it has $200 million in bonds due in 2015.

The bottom line
This is a win for J.C. Penney, but it's a very small one. The company desperately needs to get out of court and move on to the business of selling the merchandise it already has. As has been the case for the entire proceeding, Macy's is still in a comfortable position to sit back and watch the drama unfold, while J.C. Penney twists in the wind. The best J.C. Penney investors can manage now is cautious optimism -- and that's not a great place to be.

Fool contributor Andrew Marder and The Motley Fool have no position in any of the stocks mentioned. Try any of our Foolish newsletter services free for 30 days. We Fools don't all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.