New Zealand dairy cooperative Fonterra is to sell its Australian ice cream business, with the loss of 140 jobs.