If the court establishes that this was a tax, how would they administer the refund considering it's impossible to disentangle absorbed tariffs by firms and those passed along to consumers?

SCOTUS left it unspecified, but the refund would go to the payer, legally.