Facing two years in prison, former McKinsey & Co. chief Rajat Gupta now also faces a big legal bill: Goldman Sachs'.

A federal judge this week ordered Gupta to pay the bank $6.2 million, reimbursing it for its most of its legal expenses related to his insider-trading case. Gupta was a board member at Goldman and was convicted of passing confidential information about the bank to Galleon Group founder Raj Rajaratnam.

Goldman had sought almost $6.9 million. U.S. District Judge Jed Rakoff, who sentenced Gupta to two years in jail, shaved off some of that total when "the number of attorneys staffed on a task… exceeded what was reasonably necessary." But he said that Gupta offered no "colorable challenges" to their "veracity."