Can the water supply pass through a water heater before the expansion tank?
It doesn't need to be anywhere near the water heater.
It can be placed anywhere (that's not blocked by a check valve or the like from the cold water inlet of the water heater) in the cold water supply. The pressure is equalized throughout the pipes. Folks with a pressure tank for a well system don't need an expansion tank for the water heater because the well pressure tank already is serving that function as well (unless you slip a check valve in between the two for some reason, which is arguably not going to be a good reason.)
While it is common to put one intended for hot water expansion near the water heater, there's no logical reason to follow that practice, other than putting it on the same shutoff valve.
A possible detriment to your proposed location is that the tank forms a &quot;dead end&quot; - while this is very common setup that looks the same with a well pressure tank, a well pressure tank is the furthest thing from a dead end, as water is cycled through it continuously as the house uses water and the pump supplies water. With an expansion tank for hot water, the movement in and out of the tank is going to be slow and small, so the water out at the end of that pipe may be sitting there moving back and forth slightly for a very long time. Thus, a location where the cold water flow is past the tank opening may be better for the quality of water in your system.