The cost advantages depend on whether you want a quick fix or a long-term investment:

Tank heaters cost less up front but are expensive to run and wear out sooner.

Tankless heaters cost slightly more up front, but can save you substantially on your monthly bills. Comparing a standard tank heater (50-gallon, electric) with an equivalent tankless (condensed gas-fired unit), the tankless unit can reduce energy costs by 60% or more.