Wells Fargo agreed to pay the U.S. government $108 million to settle a lawsuit that it overcharged veterans under a federal mortgage-refinancing program.