The U.S. Department of Homeland Security and other federal agencies did “precisely” what a Rhode Island federal court forbade when they recently told states that they must agree to help with immigration enforcement in order to receive disaster and security funding, a judge ruled Tuesday.