Loblaw Companies Ltd. and the Canada Revenue Agency faced off in Tax Court on Monday over allegations that the retailer's Barbadian banking subsidiary had been misused for tax avoidance — a long-running dispute that could cost the retailer more than $400 million.

Department of Justice lawyer Elizabeth Chasson said Loblaw Financial Holdings took steps to have Barbados-based Glenhuron Bank Ltd. appear to be a foreign bank in order to avoid paying tax.

"The appellant has tried to make its treasury centre, whose business is to invest surplus cash until needed by its parents or its affiliates, appear to have the attributes necessary to meet the (Foreign Accrual Property ) Income exemption," she said in her opening statements on Monday.

"It did so to keep hundreds of millions of dollars offshore from paying tax in Canada."

Loblaw lawyer Al Meghji argued Glenhuron Bank met the requirements for a foreign bank under the regulations and the CRA's allegations are without merit.

The dispute, which could cost Canada's largest grocery retailer as much as $406 million according to its latest quarterly report, began in 2015 after Loblaw Financial Holdings filed an appeal.

The federal government had reassessed Loblaw's subsidiary for several tax years as far back as 2001, and concluded it should pay taxes on $473 million worth of Glenhuron's income.

Chasson told Justice Campbell Miller that the bank was more akin to a treasury centre — an in-house bank for a multinational corporation — rather than a foreign bank, which can qualify for a tax exemption. Among other things, Glenhuron did not conduct business or provide services with arms-length entities.

Meghji argued Glenhuron was a bank according to the laws of Barbados and viewed as such by the Caribbean country's central bank.

He added that Glenhuron had been audited by Canadian officials between 1992 and 2005, and its compliance had never been questioned.

Glenhuron was incorporated in 1992 and liquidated in 2013, when Loblaw decided to use that capital domestically to buy Shoppers Drug Mart, Meghji added.

"Loblaw anticipates that the evidence will show that the minister's theory is without foundation," Meghji told the court. "That the epic description of what happened is without merit."