Joey Merlino appears to have dodged another bullet.

A federal judge in Manhattan on Tuesday declared a mistrial in the latest racketeering prosecution involving the reputed head of the Philadelphia mob – a case that threatened to send him back to prison for decades.

With a jury that declared it was hopelessly deadlocked after nearly 30 hours of deliberations in five days, the mouthy celebrity mobster – whose own lawyers describe him as a "degenerate gambler" – appeared once again to have rolled the dice against the feds and come out a winner. At least for now.

Prosecutors did not immediately say whether they intended to retry Merlino on counts that also included illegal gambling, loan-sharking, and health-care fraud.

"Thank God for the jury," Merlino said to reporters as he left the courtroom. He declined to answer further questions.

"We would have been happier had Joey been found not guilty," his longtime lawyer Edwin Jacobs said in a telephone interview after the ruling. "But any time a client leaves a serious criminal case without a guilty verdict it's a good day. Not every jury can reach a unanimous verdict. This jury could not. We respect their efforts."

The mistrial, after a three-week trial, came nearly two years after federal authorities swept up Merlino in an East Coast dragnet of 46 purported mafiosi stretching from Springfield, Mass., to Boca Raton, Fla., where Merlino had set up shop since last leaving prison in 2011.

Although 44 of his codefendants pleaded guilty before trial, Merlino opted to take his chances.

His latest trial may have lacked many of the blockbuster allegations of mob-style violence that were part of Merlino's past face-offs with the feds, but the proceedings offered their own surprises.

Mob associate John "Junior" Rubeo, the government's wire-wearing star witness, caused a stir this month when he testified that Merlino had carried on an affair with a pharmaceutical saleswoman in Florida – a statement that elicited a shocked reaction from Merlino's wife, Deborah, seated in the courtroom gallery.

She stormed out, the New York Post reported, with her husband trailing behind. Merlino later approached a Post reporter outside court and told him, "Don't put the girl in" the story.

Earlier, Merlino drew the ire of U.S. District Judge Richard Sullivan after one juror reported that he had greeted her by name as she waited for an elevator.

"He just said, 'Hi, Sylvia,' " the woman later reported, according to transcripts. "I just turned my head, like, 'Some nerve.' "

Jurors first told Sullivan on Thursday – three days into their deliberations — that they were having difficulty reaching a unanimous decision. They remained cloistered for two more days before the judge relented and released them.

Even before the trial, Merlino's lawyers – Jacobs and John C. Meringolo — were keen to score a victory. Ever since their client was released from prison in 2011 – after conviction in a similar 2001 racketeering case in Philadelphia – state and local authorities have trailed him, eager to take another whack at "Skinny Joey."

Back then, Merlino had emerged from lockup bronzed and more buff than when he went in, and had declared he was done with mob life for good. He quickly decamped from Philly and departed for Boca Raton's sun-soaked beaches.

But throughout the trial, prosecutors alleged that Merlino's public declarations that he had retired and gone straight were only for show. He easily slipped back into his old role as the head of the Philadelphia mob, said Assistant U.S. Attorney Lauren Schorr during her Feb. 12 closing argument to jurors.

Merlino, she alleged, became a powerful player in an alliance that federal authorities dubbed the "East Coast La Cosa Nostra Enterprise" – a coalition of aging mobsters hailing from five crime families, weakened by years of federal law enforcement attention, a changing economy, and turncoats within their own ranks.

He muscled his way into the group's money-making schemes, ranging from extortion and offshore gambling to credit-card fraud and selling illegal cigarettes, she said. That list included a $157 million health-care fraud scheme involving kickbacks paid to doctors and pharmacists to prescribe unnecessary topical pain creams that later could be sold on the open market.

"Being with Merlino did not come for free," Schorr said. "You had to pay tribute."

But in his closing statement to the jury, Jacobs balked at what he described as a half-baked FBI investigation determined to exaggerate Merlino's importance and nail him on anything investigators could find – a case that ultimately was built on the word of mob turncoats desperate to stay out of prison.

Jacobs maintained that Merlino had made a genuine effort to go straight in Florida – working as a maitre d' in an Italian restaurant that bore his name and featured his mother's South Philly recipes.

It was a lifelong gambling habit that made him an easy mark for government cooperators hoping to lure him into compromising conversations at the behest of federal agents, who were recording every word, Jacobs said.

"Have you heard anybody [besides prosecutors] say that Joseph Merlino is the boss of the Philadelphia mob?" Jacobs asked jurors during his closing argument. "The answer is obvious – not a peep that he's the boss of the Philadelphia mob."

This article contains information from the Associated Press.