There’s an inherent problem connecting shore power to a vessel, where a common connection through the earth bonding to an adjacent vessel (or marina metal pilings) can cause an unintended circuit to be formed which causes your sacrificial anodes to become quickly eroded (I explain this problem in much more detail on my course in module #06). This can sometimes has catastrophic consequences, like your boat sinking. True recent story, which I will put another post up for later.
We can easily prevent this danger by fitting a so-called galvanic isolator. But what’s the difference between that and a transformer?
How do I know if my galvanic isolator is working? See my blog post on ‘Checking a diode’.