MIT students figured out how to make winning the Massachusetts lottery a sure thing, and a recent investigation suggests that the lottery commission knew about it.

Maybe Uncle Ben was right: With great power comes great responsibility. While most students at the famed Massachusetts Institute of Technology use their powers for good — for example, creating drugs that can fight any virus — others are busily using their prodigious math skills to game the state of Massachusetts’ lottery system, earning millions of dollars in the process.

Several years ago, while doing research for a school project, a group of MIT students realized that, for a few days every three months or so, the most reliably lucrative lottery game in the country was Massachusetts’ Cash WinFall, because of a quirk in the way a jackpot was broken down into smaller prizes if there was no big winner. The math whizzes quickly discovered that buying about $100,000 in Cash WinFall tickets on those days would virtually guarantee success. Buying $600,000 worth of tickets would bring a 15%–20% return on investment, according to the New York Daily News.

(MORE: When Good Things Happen to Good People: 8 Heartwarming Lottery Wins)

When the jackpot rose to $2 million, the students bought in, dividing the prize money among group members. But they didn’t stop there; they were so successful in their caper that they were eventually able to quit their day jobs and bring in investors to front the money they needed to purchase the requisite number of lottery tickets. Several other syndicates sprang up to capitalize on the Cash WinFall loopholes, but the MIT group remained one of the most successful and innovative. By 2005, the group had earned almost $8 million with its system, according to an investigation by the Boston Globe. By 2010, it had figured out how to win the entire jackpot in a single drawing.

A recent report by the state’s inspector general reveals more details about the scheme, including the fact that the Massachusetts Lottery knew of the students’ ploy and for years did nothing to stop it. The inspector general’s report claims that lottery officials actually bent rules to allow the group to buy hundreds of thousands of the $2 tickets, because doing so increased revenues and made the lottery even more successful. While the students’ actions are not illegal, state treasurer Steven Grossman, who oversees the lottery, finally stopped the game this year.

The inspector general concluded that because lottery officials received no personal benefit from the syndicates’ manipulations of the game, no further action was necessary.

This isn’t the first time that MIT has been involved in a gambling controversy. Ten years ago, students and a professor were involved in a massive card-counting scandal in Las Vegas casinos.