Deutsche Bahn pays for the usage of the infrastructure just like any other company using it (e.g. Flix or any of the regional carriers). The infrastructure is the responsibility of DV InfraGO (formerly DB Netz).
They are separate entities because it's mandated by the EU, the idea being it should promote competition in rail transport.