An investment fund owned by Wells Fargo & Co. has agreed to pay $40 million to settle federal charges that it inflated the value of a mutual fund that invested mainly in securities tied to home mortgages and only selectively told shareholders about the fund's problems.