Water company United Utilities has been fined £300,000 after supplying water unfit for human consumption to up to 300,000 homes.
Some 700,000 customers in Lancashire were warned they should boil tap water after traces of cryptosporidium were found in the water supply at the Franklaw water treatment works in Preston in August 2015.
Some homes were unable to drink their tap water for a month while the company worked to clear all traces of the parasitic bug.
Cryptosporidium can cause diarrhoea, stomach cramps and vomiting if ingested.
The company admitted supplying water unfit for human consumption at an earlier hearing in July.
United Utilities - which has an annual turnover of £1.7 billion - will also have to pay £150,000 in prosecution costs,
At the time, many supermarkets saw their shelves cleared of bottled water.
Preston Crown Court heard United Utilities Water Ltd spent £25 million as a result of the contamination, including £18.3 million in voluntary compensation payments to households and businesses.
Sentencing, honorary recorder of Preston Judge Mark Brown said the company failed to carry out risk assessments which could have prevented the outbreak.
He said: "It was the largest event of its kind since the privatisation of the water industry many years ago and it had a major impact on day to day water consumption.
"There was significant disruption to domestic consumers but also to businesses as well."
The court heard there was no outbreak of illness as a result of the contamination but there was an increase in patients attending GP surgeries, thought to be a result of press coverage.
Judge Brown said: "The event was completely ended by early September. However, it's likely that in the minds of many customers there would have been ongoing concerns because confidence had been affected."
Speaking after the sentencing on Tuesday, the firm's chief executive Steve Mogford said: "We are very sorry for the impact this had on our customers.
"I know from first-hand the inconvenience this incident caused, having lived in Lancashire for 40 years.
"We have learned valuable lessons from what happened and have put technology and processes in place to guard against a repeat of this type of incident."
Richard Banwell, prosecuting for the Drinking Water Inspectorate, said temporary operational changes at the Franklaw plant led to contaminated water from an underground reservoir going back into the water treatment facility from July 27 to July 31 2015.
He said: "That change in how Franklaw was operating, the redirection of treatment water from Barnacre service reservoir back into the water, was not subject to a risk assessment."
The court heard there were inherent hazards at the reservoir, including a neighbouring farm, and structural defects at the site led to cryptosporidium getting into the water after a heavy downpour of rain.