Not sure where you got the $40k for an engine from. Shouldn't cost more than $25k... $30k MAX and that's with a brand new crate LT and transmission. We've done it for a LOT less using an LS out of a wrecked Denali with only 11k on it. The motor AND trans was only $5k. The kit and labor is more of course but not $35k worth.
Again, if you already have a paid off Jeep with a nice suspension system, bumpers, armor and maybe even 1-tons, adding in an engine is WAY MORE cost effective than starting over again.