Sounds like you have a transfer case or axle problem. I'm thinking maybe a broken rear axle (axle shaft, pinion gear, or diff gears), so it works in 4x4 mode because you're driving through the front axle.
Try looking underneath (in 2WD) with trans in gear. Is the rear driveshaft turning? If so, then rear axle is bad. If not, sounds like an internal transfer case problem.
Try looking underneath (in 2WD) with trans in gear. Is the rear driveshaft turning? If so, then rear axle is bad. If not, sounds like an internal transfer case problem.