The LG Stylo is the only budget stylus phone, and it doesn't cost much more than similar spec'ed phones without a stylus. Did LG find a way to make a cheap s-pen or Wacom stylus? Not at all.
The LG stylus is actually passive and works on capacitance just like the stylus you can buy at the dollar store! Which is not to say it's useless. The LG stylus has a very sharp tip, roughly the size of a blunt pencil, so it's much, much more percise than those dollar store varieties which often are about as percise as a blunt crayon.
The "magic" if there is any, is that the Stylo needs much less capacitance to detect the tip location than most phones. Maybe the hardware is better, or maybe they just tuned the software to respond at lower thresholds. Point in case, the stylus stylus does work on other phones, like my Samsung S7. But you have to push pretty hard to get enough signal. The experience is much better on the Stylo.
The downsides of LG's approach: no pressure sensitivity, and no palm rejection. The later is the bigger issue, since it means you can't rest your hand on the phone to steady your strokes. Since the stylus is quite slippery it can be hard to draw lines and shapes unless the phone is laying flat on a table. Gravity gets in the way if the phone is at any kind of significant angle. For just tapping, however, it's fine.