Overhead power lines require maintenance too, and getting 100% coverage often involves disproportionate spend on short sections that are expensive to cover and maintain. Getting rid of masts on those sections - or even whole lines - could be a massive cost saving.
Additionally, Germany is a big train tech exporter, and there's lots of unelectrified route miles in Europe and the world, many of which would be totally uneconomical to electrify.