Fonterra has struck a deal to buy the processing assets of New Zealand Dairies, which went into receivership last month.