kitfox Put the variable into an object (array, dict or a custom class).
In C++ you can choose what outer stuff is passed into lambdas by reference and what's passed by value. Here you can't. It follows immutable passing rules for functions: fundamental types are always passed by value and objects are always passed by reference. So in GDScript you can never pass a naked float into a function by reference, be it lambda or just a regular function.
Note that from this follows that if you declare your foo as a class property instead of a local variable it will be passed by reference since it's a property of the implicit self object.
var foo:float = 5
func _ready():
var cb = func():
foo = 6
print(str(foo))
cb.call()
print(str(foo))