This is true for basically every human endeavor.
As noted by others, this isn't entirely cost-free, and there are ecological impacts. Still, on net, many dams do provide real benefits.