A pair of Massachusetts cities on Tuesday asked a judge to block the Trump administration’s efforts to strip them of all federal funding if they continue to act as so-called sanctuary cities that limit local authorities’ involvement in federal immigration enforcement.