Is there really a "free-rider-problem"? I never heard of it. As anyone else can use your streets you can use anyone elses streets as well. So there are equal conditions for everyone and I as an external observer see no "problem".
That said, you'll find patchpacks including the Infrastructure Sharing Patch (IS). The patch provides an implementation of the requested feature. A currently well maintained patchpack, that includes IS, is JGRPP (project thread on TT-Forums).
Thanks for this. There have been many suggestions and patches for infrastructure sharing and/or tolls, but none that have been completed so far. It's a frequent request that is unlikely to be met.
So I'm closing this request as we try to keep the issue count low for OpenTTD, it helps us focus on things that are important and fun. Feel free to discuss in irc or request re-opening if you disagree. Thanks for contributing!