The Corrections Department has paid out hundreds of thousands of dollars to prisoners kept inside after a sentence is complete.
About $350,000 in compensation has been paid since 2005.
The figures provided to Radio New Zealand News under the Official Information Act show compensation has been paid to 31 people in the last 8 years.
The Corrections Department says the cause for prisoners not being released could be human error, or incorrect information from other sources.
It says it has measures in place to minimise wrongful detention, and is working on improvements.
The department says prisoner compensation can be used to pay claims made by victims, unpaid fines or legal aid.