A judge on Friday said the U.S. Department of Justice cannot withhold grant funds from cities that do not work with immigration authorities.