I don't know if code allows it, but we see PVC used for interior offsets and for tank T's at least a dozen times a year.
I know that doesn't make it right, but inspectors pass it.....
What's the difference between PVC & CPVC?
A non-code real difference: PVC deteriorates over time with hot water. It is more rigid than CPVC. CPVC of the same nominal size is normally smaller than PVC. From a logic point of view, the piping to a well pressure tank would never be hot water.
From a code point of view, CPVC is allowed many places, and, as hj said, PVC is not allowed inside for pressurized potable water under newer codes-- unless an exception for wells exists, and nobody has identified such an exception I guess. My well water to the pressure tank is piped in PVC, and I am not worried about that. I thought maybe piping of well water to the pressure tank would be a special case up to a point. That is clearly not going to ever be even warm water.
I put a high clearance nickle plated ball valve on a nipple, instead of the plastic drain valve , on my water heater. This was to make flushing more effective (and I got what I thought to be an incredible amount of stuff flushed out). I used a schedule 80 CPVC nipple for the job. Normally CPVC is copper pipe sized but this nipple was iron pipe sized with 3/4 NPT threads. I could have gotten by with galvanized or brass, but I was cautious. I had used a 3.5 inch galvanized nipple when I replaced my tub diverter. Brass was not readily available in that size where I was shopping. I was amazed at the dose of rusty water that came out when I turned on the faucet after it sat for a couple of days. I replaced that nipple with a brass nipple, and no rust. Oddly one end of the nipple was screwed into existing galvanized. I think that galvanized had acquired a patina (probably from before the softener was put in) and was not putting out rust. I am probably overly concerned about a little rust. In the case of the water heater, I wanted to avoid corrosion where I could. I have put in effective filtering, so the water heater should not pick up any new sediment.