I think it's not illegal and legal because there are no rules about it.
There is/are rules about it. If you are living in a country that is religious then gambling is no doubt illegal on it but if you're living in such a nice country that is allowing people to gamble and they are taxing people's profit and as well as the establishment then there's no need to worry on it, they are legal on those places.
I think it's not only about religion. Evolved countries allow gambling (and they are religious/conservative), while poor countries don't. Evolved people know very well how to deal with gambling on their countries, they can live with it without becoming addicted and without ruining their lives and their economy. I really don't understand why poor countries are against gambling as it could generate an interesting income for the public coffers.
Wrong, most of the countries that aren't wealthy enough does have a lot of gambling place that exists. And to those countries that aren't allowing it are the ones who are mostly rich and doesn't want to let their citizens involve with such activity because they know what will be the return to their people.