This thread poses a very interesting question, and one we have probably all asked ourselves at some point. This post is a bit drawn out, so apologies for that, but most of it is pertinent to the OP's question hahaha.
I bought an NZ new 1997 SXV10 Camry wagon 15 years ago, as I wanted to upgrade from my previous generation Camry wagon. I spent quite a while looking for the "right one" as I didnt want one with any "fruit" due to there being less things to go wrong, lower maintenance costs, and more reliability etc, and I also wanted one with a full Toyota service history so that I could be sure that it would be a good candidate for long term ownership, and this one had been a company car, driven by a 50+ year old lady, traveling between Wellington, and Auckland, and everywhere in between for its entire life, so 90% of its kms were open road kms which was another big plus for me. The interior was like new, no stains anywhere, and the passenger seats appeared to have never had a bum sat in them.
I paid $12k for it, which sounds crazy for a Camry with 130,000km on the clock, but I guess at the time, it was just over 7 years old, so I ponied up and paid for it, knowing that I probably wouldnt find another one that ticked as many boxes as this one did.
As I planned on owning it for as long as possible, and to try and get the most value for money from the purchase, I got it home, and proceeded to semi strip it. I spent a couple of weeks doing a lot of uninteresting preventative maintenance, to try and ensure a long and trouble free life. I removed the door cards and sprayed the insides of the doors in fish oil, and then removed every exterior trim, all weather stripping, mud flaps, lights etc, and cleaned any build up of dirt and fine dust from them, to avoid rust forming.
Im also a big fan of quality audio, so did a fairly basic install with new speakers throughout, a new Sony top of the line head-unit, and a JBL tube sub with built in amp to put behind the back seat. Nothing over the top, but enough to enjoy doof doof without any distortion.
As time went on, apart from your typical maintenance, it proved to be as reliable as one would expect a 1997 Camry to be. The only real issue I ever had with it was when some wiring in the back door fatigued from being opened and shut so many times, which led to a short circuit and burnt out a chip on the integration relay,rendering my central locking/factory immobiliser from working, so I had to buy a second hand unit from a wrecker, and as theyre coded to the specific car, this sadly stopped my remote key fob from working, but apart from that, its maintenance costs were extremely low.
Wind the clock forward a 6 or 7 years, with over 100,000km of trouble free motoring, and sadly, due to living on the south coast, sans a garage, and with the car being constantly exposed to salty air created from the marine environment, it had unfortunately crept in between small gaps that I couldnt wash/wax and had caused some rust to form in half a dozen spots around both rear side windows, and near the aerial and top right hand side of the windscreen
Initially, I wasnt too concerned as I am fairly handy, and a bit of a perfectionsist so every 6 months, I would perform some small spot repairs and repaint the areas in question, so that I could pass a WOF, but as time went on, the rust became worse, and it got to the point that I had quite noticeable rust building up, and it was no longer easy to do my bi annual repairs. Sadly these areas werent the only place that the dreaded salt spray had got to, and unbeknownst to me, all of my brake hard lines, power steering lines, and fuel lines under the car had also been badly affected. I was faced with a very big decision, as due to the fact that Toyota no longer offered them for sale, I would need to pay to have all new lines fabricated, and installed, and coupled with needing to get all of the body rust cut out and the car repainted, this meant spending a HUGE amount of money on a car thats market value was somewhere around $2500-3000 at the time. Given the rest of the cars condition, I made the decision to go ahead and get it all fixed, which obviously meant spending what the car was worth just to keep it on the road.
Next to go was my alternator, so I bought a new one.
I also needed to get the cam belt, and water pump replaced recently, but given I wasnt in the position to buy a far newer car, I had to also go ahead and have this work done too.
The clutch is going to be the next to go, the car has done 260,000km now, and its still the original item, but I am going to baby it for as long as I can to try and get another year or two out of it, as I cant do the job myself, and its a fairly big job for a workshop due to having to drop the sub frame etc.
Even though I have spent far beyond what the car is worth, I know that I have a very reliable, extremely well cared for 90's Toyota, with a complete service history, and if I was to sell it, all I would be doing is buying another car with no idea what has been done to it, and would face all of the problems that I already have fixed on mine. So at this stage, I am planning on getting as much out of the clutch as I can, then once that is replaced, I hope to get at least 15 more years out of her. I will report back in 2034
P.S I had to replace the battery this weekend as winter killed my current one, but given it was 8 years old, thats just par for the course
TL:DR Buy a good Toyota Camry, maintain it well, and hang on to it for as long as you can