There are lots of stories about people accumulating and then using wealth to do good in the world. In most cases, wealth is generated by doing good in the first place. An invention creates wealth by making life easier, more productive, more efficient, etc.
Here's a good example.