I have a work (intel) and personal MacBook Pro (m1) and sometimes I plug the 2 together using a thunderbolt 3 cable (only one connected to a charging cable). Both charge and internet sharing/networking also works.
I do know that macbooks only accept one (the highest rated) power input, so when one is plugged in, it will also charge from the plugged in macbook to the other one.
When trying to google for the answer, I noticed a lot of misinformation about this topic, and it doesn't seem well-known that thunderbolt can be used for networking data transfer instead of "target disk mode", which is not even support on Mx macs. Anyway, finally I found a convincing answer: It depends on the order of plugging in the cable and the first mac will plug in the second![1] This is great, the user gets to decide, and I am glad you asked this question!