Engine ID by VIN or other code?

You just need to look at the casting numbers on the driver side where the starter is located. It has the size 318, 340, 360, ...
Identification
All Magnum engines are stamped either 360 or 318 on the driver’s side near the rear of the block. The casting number found on all 360 Magnum blocks is 5302006, whereas the 5.2/318 Magnums are 53006714 or 53006657. Otherwise, the 5.2 and 5.9 appear pretty much identical. Scroll down to page 14 for all the part numbers.
http://www.mymopar.com/downloads/Mopar_Drivetrain_Numbers.pdf