I have heard that the Mafia cooperated with different governments in WW2. How extensive was this cooperation and was it effective?
Mafia aid to the United State's war effort was fairly limited. Probably most importantly, the mafia agreed to guarantee cooperation of New York dockworkers with the US Navy. The Navy was concerned both with avoiding strikes and guarding against potential saboteurs:
The State of New York, Luciano and the Navy struck a deal in which Luciano guaranteed full assistance of his organization in providing intelligence to the Navy. In addition, Luciano associate Albert Anastasia—who controlled the docks and ran Murder, Inc.—allegedly guaranteed no dockworker strikes throughout the war. In return, the State of New York agreed to commute Luciano’s sentence.Luciano’s actual influence is uncertain, but the authorities did note that the dockworker strikes stopped after the deal was reached with Luciano. (source)
The mob also provided limited intelligence on Sicily:
[Lansky] approached his Sicilian business partner, the imprisoned Charles “Lucky” Luciano, to lean on Italian racketeers to cooperate with the Navy. Luciano gave the order to his goombahs, who quietly visited him in prison. Luciano provided the Navy with contacts in Sicily to assist Allied invasion planners. In return, Luciano’s 30-50 year prison sentence was commuted. He was deported to Italy, and Meyer’s status as a macher and gambling czar was secure.
There has been much debate over the real value of the Navy-mob collaboration. Surely, the legend that Luciano stormed the shores of Sicily with General Patton to greet a liberated countryside is absurd. But the Lansky/Luciano program did, in fact, guide Allied forces to key Nazi command centers on that beleaguered island.
Domestic waterfront sabotage for the rest of the war was nonexistent. Surely, the newfound cooperation of dockside racketeers had a chilling effect on German espionage. (source)
Meyer Lansky played an important role as go-between for the government and the Italian mob. Unsurprisingly, the Jewish mob was eager to fight domestic Nazi sympathizers:
For “Operation Underworld,” Meyer recruited his childhood friend, Benjamin “Bugsy” Siegel and Murder, Incorporated’s Louis “Lepke” Buchalter. These Jewish racketeers quickly became the real “inglorious bastards,” using guns, knives and bats to break up Bund rallies and send a message to Nazi sympathizers. As Meyer wryly acknowledged in his notes, “We weren’t yeshiva boys." (source)
One thing the Mafia did, for the British, was help with the return of two Generals & an Air Marshal to British lines after their escape from an Italian POW camp - when Italy surrendered & the guards scarpered. My father was in our Intelligence Corps and with his own hands gave 25,000 gold Sovereigns to a 'fisherman' who took them down-coast from German held to free territory. The gold was flown out from the vaults of the Bank of England the night before; liason with the Americans of their OSS, who probably 'facilitated' the deal, from the CinC's HQ. I believe Churchill must have okayed the whole matter! This was the second attempt, first with a submarine which missed the rendezvous. My father left annotations in two books testifying to this, plus a cryptic diary entry at the time - plus telling me - so it is factual. All kept secret at the time, & it still is re 'official' history.