Could you test drive again and scan for the exact codes?
Does the current owner have what appears to be accurate (historical) maintenance records? Proper oil change frequency is a MUST on these engines. With care, they'll last nearly forever. Mine has 245K miles and is still quiet.
Look under the oil fill cap. Is it squeaky clean inside the engine from what you can see? Pull the dipstick. Is the oil clean and translucent?
With the noise you are hearing, there is absolutely no way to tell what needs repair.
Assuming that it is tensioner or chain related...just replacing a tensioner (with the amount of interference there is to remove) will set you back hundreds of dollars. And that's just a tip of the iceberg if you need chains, sprockets, etc.
That could run up to $2K! If the chain jumps...replacement engine time.