In the US, the railroad companies are the owners of the infrastructure, with the notable exception of the Northeast Corridor high-speed line (and Metra in Chicago I believe owns some of their lines). The railroad companies are investing in their infrastructure, but as their business is freight, do not and do not have the motivation to maintain the lines for high speed passenger use.
In a number of places, rail rights of way in urban areas where modern commuter rail operates have been purchased by local authorities, usually with running rights retained for freight railroads to access yards and customer sidings. The big freight RRs have also spun off a lot of their marginal trackage to smaller 'shortline' freight operators who often have much lower costs because they don't have to conform to the same staffing and wage levels. These continue to act as feeder services for the larger companies while being free to develop other local traffic that the larger companies might not be able to compete for.