Legalizing gambling in a country will definitely be profitable because the state's income will increase from the taxes collected, besides that, people's interest in gambling will definitely decrease because the more free they are, the more bored they become. This is human instinct. Banning gambling in a country for whatever reason will be useless and will be more detrimental to the country.
I agree with you, if a country bans gambling, it is a loss for that country, because if gambling is banned, will gambling be completely and forever eliminated from their country? No, gambling will continue in every country, but if a country legalizes gambling, it is good for them, because I agree with you that through legalization, the state can increase revenue through tax collection, after all, gambling can never be removed from a country, it is impossible, so I think legalizing this issue is beneficial.
For some reason this sorta reminds me the political argument there was not long ago about the legalization of cannabis in the United States, Uruguay and Canada. People were already consuming cannabis and the money of the market was getting onto the hands of criminal organizations instead of the government.
Now, in those countries, the consumption of weed (let us call it responsible consumption) creates renevue for the government in the form of taxes and criminals cannot longer traffick that specific substance.
It has some similarities with gambling, since both weed and gambling will continue to exist in the majority of countries, regardless of the legal status of them.