Updated from 11:52 a.m. EDT

Bertelsmann AG

, the German media giant, said Thursday that it would buy

CDNow

(CDNW)

for about $117 million in cash, ending the American online music seller's arduous, months-long quest for a partner.

Under the terms of the deal, Bertelsmann will exchange $3 in cash for each share of CDNow. It also will give the ailing 6-year-old company $42 million to pay off loans and finance its operations until the transaction closes.

CDNow's shares, which had traded as high as 22 5/8 during the last 52 weeks, gained 1/32, or 1%, to close at 2 29/32. The deal consequently represents virtually no premium for CDNow shareholders, though the company may have been left with little choice.

Despite the popularity of its Web site, a destination for an estimated 700,000 music listeners each day, and the revenue growth it posted in recent quarters, CDNow has steadily been losing money. Marketing costs, some analysts say, ultimately sealed the company's fate.

"The company was inherently not extremely profitable," said Rob Martin, an Internet analyst with

Friedman, Billings, Ramsey

in Arlington, Va., which dropped its coverage of CDNow in March.

"And then to magnify the situation," Martin added, "They had to spend aggressively on sales and marketing, and that never translated to profitability."

CDNow, craving cash in spite of its relative success in selling music online, had announced in early June that it would find

a merger partner in a matter of weeks.

"The bricks and mortar companies are starting to pick up the stronger Internet sites that are floundering," said Robert Labatt, research director with the

Gartner Group

. "The reality of the marketplace right now is that finding additional venture capital is very difficult."

A proposed merger between CDNow and

Columbia House

, the music club owned by

Time Warner

and

Sony

,

collapsed earlier this year, sending CDNow¿s shares on a downward spiral from which they were unable to recover.

In March, the accounting firm

Arthur Andersen

questioned whether CDNow could stay financially

afloat on its own.

CDNow asserted Thursday that the future is markedly brighter than its troubled past.

"Our agreement with Bertelsmann represents a successful conclusion to our extensive search for a merger partner," Jason Olim, president and chief executive of CDNow, said in a statement. "We believe our combination with Bertelsmann is the best outcome."

While the accord satisfies CDNow's immediate needs, it also could help Bertelsmann, a powerful player with interests in the book publishing, music and television realms. Bertelsmann now can use CDNow to gain a stronger foothold in North America, where its name has not drawn as much attention.

CDNow will operate under its current name and will become a subsidiary of Bertelsmann's electronic-commerce group, which was created earlier this year to extend the company's global reach.

CDNow will keep its base in Pennsylvania, and its management team is expected to remain with the company. Olim, meanwhile, who founded the company along with his brother, Matthew, will report to Andreas Schmidt, president and chief executive of Bertelsmann's e-commerce division.