Gambling itself, minus the online component, was around since the beginning of the country. Even the first settlers from Europe were active there. It continued throughout the colonial times until the Gambling Act of 1908. This banned many forms of gambling and made it so that there was no gambling anywhere except for in racetracks.
There were various laws trying to regulate it over the years, but the first legal casino didn't open until 1994. Online casinos came in eventually. The problem is that you can't operate an online casino inside the country, due to current laws. However, it is actually possible to gamble in online casinos that are operated in places beyond New Zealand. Therefore, the people can still do it, it just can't be based in their home country.
Online Casinos Legality
Online gambling didn't get really going until around 1998 on the Internet in general, nevermind New Zealand. The advantage of the way the law currently stands, however, is that New Zealand citizens can still gamble if the places are based overseas when they access it online, which means that they don't pay any income taxes on it since the casino isn't actually in New Zealand.
Current State of Affairs
The gambling in New Zealand is regulated by the Department of Internal Affairs. The gambling companies in the country have to give a percentage of what they make back to the community. This is for physical casinos, however. It doesn't actually apply to the kinds online since there aren't many online casinos operating in the country due to it still being illegal. The current laws that matter here include the Gambling Act of 2003 as well as the Racing Act of 2003. Gambling on racing is legal under this act, whereas the Gambling Act talks about what is and isn't legal for any other kind of gambling. In general, this act means that any gambling is illegal unless it's sanctioned directly by the government.
New Zealand mandates that kind of control. This includes lotteries, the slot machines or pokies, or anything else. The law governs online casino use for New Zealanders as well, which is currently legal as long as the company isn't being operated inside the borders.
The act also regulates how big a prize can be, which has a lot of variation based on the situation. It's worth noting that it's also illegal to advertise for overseas gaming operation as well. These days, the estimation is that 80% of people in New Zealand do some kind of gambling, so it's rather common despite the laws that go into it. This is impressive considering there are only 6 brick and mortar casinos in the entire country. That means that a lot of these 3.6 million people are gambling using online avenues.
Overall, when all matters are considered, New Zealand is functionally rather permissible when it comes to what it allows. Being able to access any online casino, as long as you're old enough is, in practice, a permissive thing to do. This is also likely a good reason why so many people gamble in the country. The fact that there's no need to pay income tax on the winnings is likely a big cause of this particular outcome as well, generally speaking. It definitely looks like the history of online gambling isn't finished in the country and will continue well into the future.