Judge William Young of Boston said the Trump policy chilled political speech and amounted to ideological retaliation.