For instance, other parts of the world have moral principles more in line with "don't get caught" or "don't embarrass your superiors" or "never side with anyone against The Family" than with "do no harm".
The typical American standard of morality is set so high that no one, other Americans in particular, including the very person professing that moral standard, can be reasonably expected to live up to it. Hypocrisy abounds among those with ultrahigh moral standards. Furthermore, the details of American morals are so diverse that anyone who manages to be a paragon by one person's standard may be no more than a low-life slimeball by another's.
In contrast, compliance with the letter of the law is a far more achievable standard.
If there is anyone who is at fault here, it is the mathematically incompetent person who designed the payout system for the lottery. This was, at its heart, no different from a finance quant unraveling the details of a complex derivative to discover an arbitrage opportunity for the firm. Discovery and use of the exploit corrected the artificially high margin for the state in administering the game to one more realistic for the mathematically flawed payout model.
There used to be a sign on I-10 as you approached the Biloxi, Mississippi area. It was for a casino and said something like "Our slots have 98% payout!". I have no doubt as to the veracity of such a statement, because 2% of the money that flows through slot machines is more than enough to turn a profit from them.
These lotteries are obviously a different story since you can buy as many tickets as you want.
Lottery TV commercials literally make me want to puke every time I see them. https://www.youtube.com/watch?v=yaB28DCxFQI
My question is why would taking advantage of this system for one's own gain be unethical? The administrators believe (apparently erroneously) that they have a built-in statistical advantage over anybody playing. So by the logic that the MIT students shouldn't exploit a flaw in the system even though it is legal because it is unethical, then the lottery administrators should not be able to run a lottery for the same reason.