A sweeping US tariff regime has generated enormous revenue in a single year, even as its legal foundations face scrutiny.