Thank you for the reply.
I tried turning off the supply to the washing machine,
and the toilet separately, and then I tried them together.
(we don’t have anything else that would use cold water
other than the kitchen and bathroom faucets), but the
banging in the water heater persisted.
It appears to be a closed loop system as you stated,
however there isn’t a pressure regulator or backflow
preventor visible inside the house. The line exits
through the basement floor and runs about 20 feet
to the city shut off valve in the front yard. And the rest
of the system is just plain old copper pipe.
The noise wasn’t present with the old water heater
we had, but that thing wasn’t very efficient either, so
maybe thermal expansion wasn’t an issue.
Any other suggestion?