Tank water heaters cost less because of their simple design, shorter life expectancy and ability to be replaced more easily utilizing existing venting, gas (or electric), and plumbing connections.
Tankless water heaters cost more because of a more powerful burner, computerized controls, longer life expectancy, and the need to reconfigure gas, plumbing and venting in a replacement situation.