A brewed cup is almost entirely water, and the minerals in it are not neutral. They participate directly in extraction, which is why the same beans taste different in different cities.
Minerals do the extracting
Water pulls flavour compounds out of ground coffee, and dissolved magnesium and calcium ions help bind and carry certain of those compounds into solution.
Distilled water, containing almost nothing, extracts poorly and produces a thin, hollow cup even at correct temperature and grind.
Which means water hardness is not merely a scale problem for the machine. It is an input to the flavour, on a par with the roast.
Hard and soft pull in different directions
Water high in magnesium tends to accentuate brightness and fruit character, because it favours the compounds responsible for those notes.
Water high in calcium leans towards body and heaviness, and in excess contributes to the chalky flatness some tap water produces.
Neither is correct in the abstract. The pairing between water and bean is what matters, which is why a coffee that shone on holiday can disappoint at home.
Alkalinity buffers the acidity
Bicarbonate in water neutralises acids as they are extracted, damping the brightness a coffee would otherwise show.
High-alkalinity water therefore flattens a delicate roast, while very low alkalinity can leave a bright coffee tasting sour and unbalanced.
Municipal supplies vary in this measure across a single city, and treatment changes seasonally, which accounts for a cup shifting without any change in method.
Filters change chemistry, not just taste
Carbon filters mainly remove chlorine compounds, which improves aroma but leaves mineral content largely intact.
Softening filters exchange calcium and magnesium for sodium, which prevents scale but strips out the ions doing useful extraction work.
Reverse osmosis removes nearly everything, producing water that usually needs minerals added back before it brews well.
Consistency beats optimisation
Chasing an ideal water profile is a deep rabbit hole, and most of the benefit at home comes from removing the variable rather than perfecting it.
Using the same source every time makes grind and dose adjustments meaningful, since the results are no longer confounded by an invisible change.
Bottled water with a stated mineral content is a practical way to hold that constant, and comparing two sources side by side reveals how large the effect is.