"Betting" was made legal by Temer (2018), the Bolsonaro administration (2019-2022) should have regulated it, but they refused to do so. Lula (the current president running for reelection) did finally regulated them back in 2023 (i.e., made them finally pay taxes and introduced a few protection mechanisms and data sharing obligations), however it was still a societal problem as you put it, which they finally fixed today by banning.
Your comment makes it seem like the current administration allowed bets in the first place. That didn't happen.