There has always been a huge underground "society" in Hong Kong. The movie producers don't just imagine plot lines and backgrounds for "A Better Tomorrow", "Infernal Affairs" and all the rest.
The key is a "balance". The cops and the triads each know their bounds. When one side pushes it too much, then the other side pushes back. And the society needs its "entertainment", which these places provide. If you crack down on them too much, people are not going to stop the activities - you just push more to go to Macau and more significantly these days - Shenzhen. Which the HK authorities have zero control over.
So, as long as nobody is getting killed. No huge number of young people overdosing, and not too many people jumping off highrises due to gambling debts, this "balance" is maintained. Everybody's happy.