The investigation was illegal because the law enforcement agency involved is only authorized to spy on foreigners, while Dotcom became a New Zealand citizen in 2010, the BBC reported Thursday.
The spying occurred just before police raids of Dotcom's New Zealand home and the offices of Megaupload by New Zealand authorities, in cooperation with the FBI, which alleged Megaupload was engaged in copyright piracy.
The U.S. Department of Justice seized and shut down the Megaupload domain name in January following an indictment charging Dotcom and others with allegedly operating as an organization dedicated to copyright infringement.
A New Zealand court ruled in June the search warrant used in the raids was illegal.
In a statement, Prime Minister John Key said: "I apologize to Mr. Dotcom ... We failed to provide that appropriate protection for him."
The illegal surveillance was the result of "basic errors," Key said.
The Justice Department attempting to have Dotcom extradited to face charges in U.S. courts, with an extradition hearing set for March 2013.