The Supreme Court on Thursday limited a federal law that prohibits illegal drug users from possessing firearms, in a case involving a man who was charged after investigators found a gun in his home and he admitted using marijuana about every other day.