By Jessica DiNapoli

NEW YORK (Reuters) - Gawker Media LLC asked a U.S. bankruptcy court judge on Monday for permission to borrow up to $22 million from an affiliate of buyout firm Cerberus Capital Management LP to help it through its sale process, according to a court filing.

The online publishing pioneer filed for bankruptcy last week after it failed to secure a postponement on paying $140 million to Hulk Hogan after it lost a lawsuit involving the publication of excerpts from a sex tape of the former pro wrestler.

Media company Ziff Davis LLC has entered into an agreement to buy Gawker for $90 million, setting the floor for an opening bid in a court-supervised auction expected to take place at the end of July.

The loan from Cerberus, which often invests in companies in financial distress, will help Gawker continue to operate through bankruptcy. Gawker and its bankers reached out to 37 different potential investors in May to see if they had an interest in backing the loan, according to the filing.

Gawker is known for running salacious stories, and Cerberus has a history of controversial investments.

One of its investments, Freedom Group Inc, is the maker of the Bushmaster rifle that was used by Adam Lanza when he killed 20 children and six adults at Sandy Hook Elementary School in Newtown, Connecticut, in December 2012. The families of the victims subsequently sued Freedom Group.

Cerberus declined to comment.

Billionaire investor Peter Thiel, an early backer of Facebook Inc and PayPal Holdings Inc, bankrolled Hogan's lawsuit. Gawker had posted a 2007 article about Thiel entitled "Peter Thiel is totally gay, people."

(Reporting by Jessica DiNapoli in New York; Editing by Cynthia Osterman)