The basic reason that Native American tribes are allowed to run casinos on reservations is because they are, to some degree, sovereign nations. The Supreme Court has interpreted the US Constitution to mean that Indian tribes have some degree of sovereignty and are therefore not completely subject to the laws of the states in which their reservations are located.
The Supreme Court first explicitly allowed Indian gaming in 1987. After that Congress passed a law that regulates such gaming. It says that the Indian tribes and the states in which they live to come to agreements on the exact rules for Indian gaming in each state.
Indian gaming, then, is guaranteed by an act of Congress that is based on the fact that Indian tribes have a degree of sovereignty.