There are three types of front hub on a Ranger, depending on year. The first is a manual locking hub. These, you can drive in 2WD with the hubs locked, and the front axles, differential, and drive shaft will turn with the wheels, even though they are not being driven by the transfer case. Generally, though, it's better to get out of the truck, and rotate the knob on the hub to the unlocked position, which will allow the front wheels to rotate freely.
The second, are vacuum actuated. These lock and unlock automatically, using vacuum, when you engage or disengage 4WD. They sometimes fail, and people swap them with a manual hub as a matter of personal preference.
The third are always locked (what are they called? I want to call this setup a live axle, but "live axle" refers to something else, right?), which means the front axles, differential and drive shaft always rotate, whether you select 2WD or 4WD.
In order for people to help you, we need to know more about your truck. Year is a good place to start. Later trucks, if I'm not mistaken, only had the third kind of axle. Middle years only had the vacuum actuated hubs, but early trucks had either manual or vacuum actuated.
Jim's truck (
@Jim Oaks), by the way, was a 1997, I think, with the vacuum actuated hubs. If I had to guess, he fixed it by swapping them for manual hubs. Right, Jim?