As a parent, by not always being strict but being friendly with your child
In some ways, that might be the root of the problem. I think that my parents were much more strict with me, than I am with my children. In general I think parents today are more light towards their kids, than parents were 20-30 years ago. Modern parents let go way to many thing, close eyes on many things, allow to much and dont stop whenever kids are misbehaving. Not every parents a like that, but I see a lot that say «he is just a kid», «its just a period of being teenage», «we are tolerant parents». As if parents wait that kids will understand everything (their bad behavior for example) themselves. If we connect it with gambling, then some parents think that «a kid will play with it for a while and forget about it; there is nothing bad about it». When they should be more strict to their children.
I have some experience in raising children, whether my own or not, and I will say that parents who allow their children to do whatever they want and at the same time stand aside saying "I give my child freedom" are bad parents. They are lazy and do not have the inner core to be strict with their children. And then such parents are surprised that their child grew up a gambler. You need to be strict but fair. And then the children will grow up with the ability to resist temptations like uncontrolled gambling.