The agreement was an extraordinary example of how the Trump administration has offered legal relief to those aligned with the president.