Winning the lottery isn't just a game of chance, a group of MIT undergraduates and a biomedical researcher have proven.

A brainy group of MIT math and science majors purchased around $40 million of Massachusetts Cash WinFall lotto tickets over seven years, and won $48 million, coming out ahead by $8 million, the Boston Globe reports.

They legally calculated the mathematical odds and found that when the lotto prize reached $2 million, they could buy $100,000 worth of tickets, in one day, and almost always win.

The Massachusetts Cash WinFall game allows people to buy as many tickets they want on any day, so the students did nothing illegal, reports the Daily Mail.

Ironically, Lotto officals knew their system was being 'played' in 2010, but did nothing to stop the students, because Lotto keeps most of the money from tickets bought.

The Lotto was finally ended by Massachusetts state treasurer Steven Grossman, who claimed that the students had "special opportunities" others did not [simply by calculating the odds and buying at the right time].

Grossman told the Boston Globe: "I feel it is important to essentially apologize to the public because a game was created that allowed syndicates to gain special opportunities that others did not have, using machines themselves, partnership with lottery agents, using them after hours. We're sorry some gained unfair advantage."

"Revenues were tremendous and the lottery benefited, but there were practices that were not appropriate and things done that were not right."