You can kind of think of it as syntactic sugar over adding strings that desugars at the compilation stage.
"abc #{x} def" would desugar to "abc"+x+"def"
Because it's happening at the compilation stage, it can only be done on string literals (which as we've seen is actually an advantage security wise).
The reality is actually a tad more complicated, because you can make efficiency improvements and only create one string instead of all the intermediate strings etc. but the effect is the same.