When the numbers don't match it's an indicator that it might be stolen, Twolanerider is right... the VIN will be compared against those that have been reported.
Even if they suspect that the theft was not reported yet, the second "clue" is when the person in possession of the property knows very little about it.
The bike could be seized for further investigation based on probable cause, or in Canada we call it reasonable grounds, but someone who stole the motor is not going to know the particulars about it.
If you pay 5k for an engine I'm confident that you would be able to answer anything that was thrown at you.
Most cops wouldn't know where to find the VIN let alone know how to read it, so I wouldn't worry about it too much, the time I could see a real possibility of an issue is if you cross the border between Canada and USA and the motor still looks fairly new. Those folks have a lot of authority and their search and seizure powers are far more significant than the police.
If it was me and I were crossing the border under those circumstances, I'd bring along a copy of the bill of sale for the motor.