The ruling deals a major blow to the US president’s signature economic policy and represents a stinging political setback.