A rare letter from Alexander Hamilton that was stolen from the state of Massachusetts more than 70 years ago has been returned after a battle in court.