have the drive train failure codes read by a shop near you. report the findings here.
If its just the encoder bad then have that work done near home. see if the used car dealer will cover it. keep all paper work.
could be bad wiring. wiring is very fragile on these vehicles. the fuse box underhood wires to the transfercase get damaged very easily.
If the transfercase fluid is black then you should consider getting your money back/return the vehicle. cost can be quite high.
the encoder usually fails because the fluid is black/damaged. this stresses out the encoder. the black is clutch material which in most cases is from operating the vehicle in any 4wd setting on solid dry pavement , also tires of different wear or size . all tires need be worn and rotated to keep at the same size / wear.