Toyota corolla engines are not cheap like your mechanic is assuming,
A corolla 1.8 engine costs abt 1400 or more for a good one from a yard while a chevy 5.3 can be had for 600 or less.
If your car was being maintained at jiffy lube or somewhere similar this is bound to happen, The rattle can be fixed with a new vvt phaser unit but costs about 350 in parts and about 2 to 2.5 hours labour.
However, i have seen these engines run forever with this noise. When the phaser fails though, your engine will fail to work, the repair cost will be slightly higher,
i never advise to buy a used corolla in USA as they are owned by poor students or people who dont care or dont have money to maintain it, so they usually suffer from no oil change to driving them to death.
Camry is better choice than corolla in used market
Btw 61k miles on a 2009 corolla? Sounds fishy