I know, it's a good practice to reuse the input msg in a function but in this case it can be painful to find out what is going on.
If you reuse the msg in the following nodes, your first msg is also changed.
Try this example:
[{"id":"8def5c6a.3c9ad","type":"function","z":"66646ca8.e97654","name":"","func":"msg.payload = 'my msg is awsesome';\n\nnode.send(msg);\n// how to fix it\n// node.send(RED.util.cloneMessage(msg));\n\nmsg.payload += ', it can be changed outside of my function.'\n\nreturn msg;\n","outputs":1,"noerr":0,"x":290,"y":3600,"wires":[["e5378dfa.6fcb2","c799d2d2.10153"]]},{"id":"5258df92.76677","type":"inject","z":"66646ca8.e97654","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":3600,"wires":[["8def5c6a.3c9ad"]]},{"id":"e5378dfa.6fcb2","type":"function","z":"66646ca8.e97654","name":"","func":"msg.payload = 'my msg is foobar';","outputs":1,"noerr":0,"x":450,"y":3600,"wires":[[]]},{"id":"c799d2d2.10153","type":"debug","z":"66646ca8.e97654","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":470,"y":3660,"wires":[]}]