A federal judge has ordered the Trump administration to restore funding for a rail tunnel between New York and New Jersey.