Mobil vacated the sites in 2011, and Waterfront Auckland plans to redevelop the area with parks, apartments, shops and commercial premises.
Both parties agree the site is now significantly polluted but disagree on the contamination's source and Mobil's liability for the clean-up.
Some of the pollution comes from fill material used when the land was originally reclaimed, including waste from the old Auckland gas works.
Agency counsel Alan Galbraith, QC, said it was seeking remediation costs only for Mobil's contamination, not for the gas works' waste.
The clean-up would involve removing soil to a depth of 3.5m at the same time as redevelopment.
Mr Galbraith said the case hinged on new leases signed in 1985, when the new pipeline from Marsden Pt to Wiri was commissioned and oil companies were expected to progressively pull out of the tank farm.
Those leases expired in 1993, but Mobil and Ports of Auckland were unable to agree on new terms relating to site remediation, so the leases continued on a periodic basis under existing terms until 2011.
The 1985 leases, unlike earlier versions, included a clause related to keeping the land clean and tidy.
Mr Galbraith said that meant Mobil was obligated to return the land "in good condition and that means free of contamination".
For Mobil, Michael Ring, QC, said there was no breach of the tenancy contract, and the company was not liable for costs. He said the "clean and tidy" clause was never intended to require Mobil to remove historic sub-surface contamination.
The agency's claim could relate only to the most recent 1985 leases, he said, as each subsequent tenancy was a separate legal contract, and claims against previous contracts were now time-barred.
However, the substantial pollution occurred well before that time.
Mr Ring said that in 1985 it was not envisioned the site would be used for anything other than heavy industry.
It was already heavily contaminated from reclamation fill, which included lead, arsenic and cyanide pollution. "This was not a pristine green meadow that somehow has been destroyed by sub-surface contamination." APNZ