A Massachusetts federal judge ruled Tuesday that the Trump administration’s policy of arresting, detaining and trying to deport foreign students for Palestinian advocacy violates the First Amendment, which the judge said protects the free speech of noncitizens and citizens alike.