The Trump administration improperly targeted the firm based on its clients’ political positions, a court said.