An extra $38 million will be invested in improving the quality of water entering the Great Barrier Reef lagoon from nearby farms.