Earlier this summer, two of my fellow Fools debated the merits of Borders Group (NYSE:BGP) as a potential investment. The bookseller's recent second-quarter results appear to favor the bear argument, but only marginally so.

I emphasize the word "marginally" to reflect Borders' continued struggles with gross and operating margins. We can debate the cleverness of my wordplay, but there should be little dispute over the company's biggest glaring problem right now -- profitability.

On a positive side, the bookseller significantly outpaced analyst revenue expectations. Borders generated $945.1 million in sales, driving strong top-line growth of 10.4% compared to the same period a year ago. Even comps at Borders superstores managed to chip in with solid performance, increasing 4.6%. Not surprisingly, customers responded well to the final installment in the Harry Potter series, Harry Potter and the Deathly Hallows. But management attributes some of its boost in sales to more than just the success from J.K. Rowling's magical story. Its Borders loyalty program contributed to the second-quarter numbers by helping to increase traffic to its stores.

One might expect that stronger-than-expected sales would boost the bottom line, but actually we often find that the reverse is true. A busted cookie machine doesn't all of a sudden make perfectly shaped, delicious cookies just because we put more cookie dough into the machine. Doing so only produces more busted cookies. The same is true for Borders -- until the machine is fixed, we can continue to expect busted bottom-line results. By the time the stronger-than-expected sales figure worked its way down through the company's broken margins, coming out on the other end was a wider-than-expected loss of $0.43 per share.

Borders is contending with the usual suspects here: internal missteps, such as being woefully late to the game in online book sales, and external competition pressures created by the likes of Barnes & Noble (NYSE:BKS), Amazon (NASDAQ:AMZN), and Books-A-Million (NASDAQ:BAMM). Borders can't cast a Harry Potter spell and magically do away with the external factors, but it can continue searching for the right internal ingredients to get margins, and thus profits, going in the right direction again.

With Harry Potter being the hottest item on bookshelves across the industry, Borders earned lower-than-expected margins in order to offer the most attractive prices to consumers. Additionally, management believes the factors causing the shrinking margins are controllable, and the team has been implementing a plan to return to normalized margins by fiscal 2009. The question facing Foolish investors is whether you believe management's game plan can get this company back on track. If you do, then the stock's recent sell-off may prove to be a significant buying opportunity.

Read on for related Foolishness:

Borders is an Inside Value pick. Amazon is a Stock Advisor recommendation. Try any of our newsletters free for 30 days.

Fool contributor Jeremy MacNealy has no financial interest in any company mentioned. The Motley Fool's disclosure policy just likes to hang out and browse the magazines.