I have about 5k miles on my bike, and just over $2k into it so far. It is about ready for the scrap heap, so I'd argue it has minimal residual value at the moment. $0.40 a mile for biking, about the same as the ~$0.50 a mile rule of thumb for driving a car.
My ~$1k bike has gone through a set of pedals, a rear wheel, 4 chains, 2 rear cassettes, two big chain rings, one medium chain ring, one derailleur, one rear hydraulic brake assembly, one seat, a seat post clamp, new grips, new handle bar, about a dozen spokes, 3 tires, about 10 tubes, a front shock rebuild (that still leaks), and a bottom bracket. It has also cost a cargo rack, panniers, several bike lights, a new helmet, waterproof outer gear, waterproof bike boots, cold weather over mitts, a few sets of bike gloves, at least $150 in accumulated bike specific tools, etc. Most of the work was done by me, but I have taken it to the shop for some of the repairs when it exceeded my skills, tools, and/or schedule. Winter sees lots of grit that really is harsh on my bike, I would probably have half the wear on it if it was a fair weather only commuter bike. The frame is showing corrosion starting at the rear wheel mounts so I will likely need a new one in about a year or so.
So on the whole I am not ahead by any real amount, but I enjoy it and will soldier on regardless of the money aspect, and the likelihood of getting run over.