The U.S. Supreme Court handed down a 5-4 ruling that defied ideological divides on Thursday.