He was not ordered to pay Phelps' legal fees, only court costs (filing fees, court reporters, copying costs, etc.). That is mandatory in every federal case-- the loser always is ordered to pay costs, under Federal Rules of Civil Procedure 54(d)(1) and Federal Rules of Appellate Procedure 39(a)(3).
The proposals for "loser pays" are to require the loser to pay the winner's lawyers' fees, which are typically much, much more than the court costs.
The judge ordered him to pay phelps $16,510. That doesn’t sound to me like court costs.