New Zealand have retained their Rugby Championship title after beating South Africa 38 points to 27 at Ellis Park.