Bollt in, no. Fit with lots of extra work and expenses, yes.
XJ Cherokee and ZJ Grand Cherokee 4.0L engine blocks interchange.
2000+ TJ Wrangler and WJ Grand Cherokee 4.0L engine blocks interchange.
XJ/ZJ blocks do not interchange with 2000+ TJ Wrangler or any WJ Grand Cherokee blocks without significant modifications.
TJ Wrangler and WJ Grand Cherokee 4.0L Engine block castings underwent major physical design changes effective in the 1999 WJ Grand Cherokee, and 2000 TJ Wrangler. These “S” VIN code engine blocks from a 1999-04 WJ Grand Cherokee and 2000-06 TJ Wrangler are not bolt on interchangeable with any XJ Cherokee or ZJ Grand Cherokee engine block.
The reason why these blocks do not interchange is that the casting design changes relocated numerous bolt holes, altered the physical location of all the fan belt driven accessories, and in some areas eliminated the metal that could be drilled and tapped for the earlier configuration of motor mount bolt holes and fan belt driven accessory mounting bracket bolt holes.
XJ compatible engine are as common as dirt. Remove and re-use ( or replace with new ) as needed or required from your original engine: Intake/Exhaust manifolds, motor mounts, throttle body, fuel injector rail, flex plate/flywheel, cylinder head, water pump, distributor-less ignition or distributor assembly, OBD engine computer sensors, fan belt driven accessories, and/or mounting brackets.
If your 2000-2001 XJ Cherokee has a cracked 0331 head, buy a good used redesigned and more durable TUPY 0331 head from a 2002+ 4.0L TJ Wrangler or WJ Grand Cherokee.