Where do trees get their mass?

While removing carbon from the atmosphere is obviously a nice thing, I’ve read that trees are essentially carbon neutral when it comes to climate change. That’s because the carbon is rereleased into the atmosphere when the tree dies and decays.