The 6-3 ruling is a major blow to the president’s signature economic policy.