President Trump has suffered another legal setback in his court fight against the attorneys general of Rhode Island and other states over his proposed federal funding freeze.