the same way they lost control of .......
liquor, the race wire, hollywood, the lottery, some would even say prostitution. big business decides they can no longer ignore these cash cows so they get the govt(ie: big business) to legalize it. they create a licensing agency to oversee the industry, thus putting the mob out of business. (not that I'm a fan of the mob, just not a fool that can't see through the governments,corporate america, hypocrosy)
watch those movies recommended and you might start with the book, "The Outfit: the role of chicago's underworld in the shaping of modern america" Gus Russo 2001 bloomsbury. .... also related is anything about howard hughes' years in vegas. I particularly like bob maheu's book.