From my personal experience the 4.0 is a great motor. Readily available parts nearly anywhere I go, relativity inexpensive, reliable on and off road. *Decent* mpgs, (upper teen avg with 4wd)
Just a few examples, my sisters 4.0 cherokee, 3xxk miles, her husband 230+, my father 198k, my last 4.0 215k and ran GREAT when sold.
So real question is, what are you looking for? A trail rig, a daily or both?
I personally stray away from "rebuilds" unless done as an upgrade.(4.6 or 4.7 stroker) It has been my experience, the main reason for a rebuild is negligence in maintenance. And from my personal car buying experience its usually not just the engine, and that's the first to go. Ask me how I know
So, best of wishes in your future purchase, if you are patient and find the right one, I assure you will not regret buying a cherokee. The 4.0 can tow, haul and crawl. And its fun enough to drive around daily. Auto or manual, both I have owned and like.
P.S. read up on the 97-01 cyl head/head-gasket issues. Not trying to scare you, just be cautious.