This is my understanding (although some gun rights fanatic may school me on this):
Technically the US Constitution only applies to the Federal government, not state governments. But there's a loophole, where the Supreme Court can decide that parts of the Constitution apply to states through the Due Process Clause of the 14th Amendment. Over time they have used this loophole to make all but a few rights from the Bill of Rights apply to states. The 2d Amendment's right to bear arms is one of the few rights that have not been extended to the states (along with the Fifth Amendment right to an indictment by a grand jury and the Seventh Amendment right to a jury trial in civil cases). So states technically can outright ban guns if they want. Now I know they just had that Washington DC case . . but DC isn't a state and I'm pretty sure that the Supreme Court still has not extended the 2d Amendment right to bear arms to the states.