Taxpayers could be on the hook for tens of millions after the federal government was dealt another costly immigration blow in court.