I think it definitely depends on the truck & how it's set up.
I currently have a '90 Dodge W-350 Ram with auto trans and nice tires. It will literally go anywhere I want to go with the many choices available: Hi-2, Hi-4, Lo-4. It gets good mileage for a truck of its size though the TBI gasser 360 isn't my 1st choice!
My '67 Dodge D-300 [upgrade from D-100] Town Wagon with a clutch type Limited Slip rear & manual trans would go ANYWHERE I wanted to go, WITH THE RIGHT TIRES & GEARS!
I run lake beds, prospecting in the deserts, off road in the mountains & all the rest with 2WD and get incredible mileage thanks to the 4BT.
I know many, many ranchers that have used 2WD posi or limited slip for years & years as their only field trucks, with no complaints. You have to use a different driving style and the tires & gears are what it's all about. You run in more aggressive and keep your momentum up and just like 4 wheeling, you pick the best route.
I pulled out several stuck 4 wheelers with my 2WD Dodge, loved every minute of it. Or better yet, drive on by, wave and toot the horn, come back in a while and pull them out hah!
That said, with Cummins fuel mileage and IF YOU DO REGULAR MAINTENANCE a 4WD offers capabilities impossible with 2WD.
You just add 20% to overall maintenance costs and get on down the road. With a gasser it costs about 2 miles per gallon for 4WD, I see similar for diesel.