If the lotto game is designed badly then yes, calculations can be used to win more than you spend. There was a recent good movie, based on true events, of someone finding a flawed payout system. The guy won 26 million over 2 years. The flaw in this case was increasing the odds of winning when someone didn't win, he spotted the flaw and legally exploited it.
https://www.imdb.com/title/tt8323668/