Using the iPhone 15 Pro as Apple intended

https://sopuli.xyz/post/3830336

Using the iPhone 15 Pro as Apple intended - Sopuli

I have no idea what I’m seeing here.
iPhone 15 pro USB C charging a Apple Magic mouse (lightning port located on the bottom).
How does the phone know not to charge itself by draining the mouse?