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 and 2000+ TJ/WJ blocks do not interchange without significant modifications. (1997-1999 4.0L TJ Wrangler blocks will interchange in XJ/ZJ and visa-versa).
TJ/WJ 4.0L Engine blocks underwent clean sheet design changes effective in the 1999 WJ Grand and 2000 TJ Wrangler. These blocks are not interchangeable with XJ/ZJ engine blocks. The reason is motor mount bolt holes and belt driven accessory mounting bolt holes are in different locations, or not present at all, TJ/WJ vs. XJ/ZJ.