The federal government has agreed to pay $300,000 to settle a lawsuit brought by an Egyptian who was among dozens of Muslim men swept up in the New York area after 9/11, held for months in a federal detention center in Brooklyn and deported after being cleared of links to terrorism.