In the old JVM backend, local functions were compiled as JVM classes, so there were an instance to pass around. Today, they are compiled to static functions in the containing class/facade, and calls to them compile natively.
KtFirImportOptimizer
PsiElement.getExpectedType()