It seems that a large part of the problem (aside from flawed algorithm) is that they allow people to pick the tickets they want to purchase. If they required people to buy the tickets in order they're dispensed from the roll it would bring the abuse down dramatically.
Even if you were able to crack the code you'd have to wait for others to buy the losers before a winning ticket would show up. The flaw in this would be if the store selling the tickets was be in on the scam. They'd be able to sell a bunch of losers and pull any winners as soon as it was their turn to dispense. But as with most crimes, the more people involved in it, the harder it is to keep quiet about it and pull it off.
Even if you were able to crack the code you'd have to wait for others to buy the losers before a winning ticket would show up. The flaw in this would be if the store selling the tickets was be in on the scam. They'd be able to sell a bunch of losers and pull any winners as soon as it was their turn to dispense. But as with most crimes, the more people involved in it, the harder it is to keep quiet about it and pull it off.