Banking giant HSBC has reached a $470 million settlement with the federal government and nearly all states over mortgage lending and foreclosure abuses that officials say contributed to the country's economic meltdown, the Justice Department announced Friday.