If there is no Will, the estate is distributed in accordance with the Administration Act.
The Public Trust can advise on these issues: website

Points from the Law Commission Report 134 (2015): Death, Burial & Cremation:

12.86 Currently, local authorities must allow the bodies of any poor person or person from a hospital, prison or other public institution to be buried in their cemeteries free of charge.* That obligation extends also to the free provision of cremation by any person who has control or management of a crematorium.

12.88 … there will sometimes be circumstances where there is no executor, personal representative or family member to make funeral arrangements and dispose of the body.
In those circumstances, there is a public interest in someone stepping in to dispose of the body in a respectful manner. … The Police tell us that they go to considerable effort to identify family or extended family members and that, in the vast majority of cases, someone steps up to organise a funeral, even if it is the most basic funeral covered by the funeral grant from Work and Income New Zealand. When the deceased person identified with a particular cultural or ethnic group, unrelated people from that group will often agree to organise a simple funeral if there is no local family.

* Burial and Cremation Act, s 49: Burial and cremation of poor persons
(1) A local authority having the control and management of a cemetery and any person or body of persons (including a local authority) having the control and management of a crematorium may, and upon an order signed by a Justice shall, permit the body of any poor person, and of any person from any hospital, prison, or other public institution, on the request of the person in charge of such institution, to be buried in the cemetery or cremated in the crematorium free of charge: provided that every Justice, before signing any such order, shall satisfy himself that the deceased person has not left sufficient means to pay the charge, and that his relatives and friends are unable to pay the same.