May a former U.S. president be part of a successor's administration? More specifically, may Hillary Clinton make Barack Obama a member of her cabinet?
Are there even any historic precedents for such a move?
The relevant legislation appears to be the United States constitution (which defines some of the processes and procedures around the office of the President) and the United States Code (which includes some description of the scope of the Executive branch). The only specific proscription on the activities of former presidents seems to be the 22nd Amendment which states that
No person shall be elected to the office of the President more than twice, and no person who has held the office of President, or acted as President, for more than two years of a term to which some other person was elected President shall be elected to the office of the President more than once. But this article shall not apply to any person holding the office of President when this article was proposed by the Congress, and shall not prevent any person who may be holding the office of President, or acting as President, during the term within which this article becomes operative from holding the office of President or acting as President during the remainder of such term.
It's fairly clear that this doesn't apply to other executive offices.
In practice this is fairly unlikely to happen, if only because of the distracting sideshow of having one's predecessor in the job hanging around. The only remotely similar case I can think of is that of William Taft who eight years after serving as America's 27th President was appointed Chief Justice, and thus head of the judicial branch.
Short answer: No, there is nothing formal preventing a former U.S. President from being a cabinet-level official (like a departmental Secretary).
The relevant law is the Appointments Clause of the Constitution (emphasis mine):
He (the President) shall have the Power, by and with the Advice and Consent of the Senate, to make Treaties, provided two-thirds of the Senators present concur; and he shall nominate, and by and with the Advice and Consent of the Senate, shall appoint Ambassadors, other public Ministers and Consuls, Judges of the supreme Court, and all other Officers of the United States, whose Appointments are not herein otherwise provided for, and which shall be established by Law: but the Congress may by Law vest the Appointment of such inferior Officers as they think proper, in the President alone, in the Courts of Law, or in the Heads of Departments.
The Constitutional allows the President to appoint members of his government, but requires the "advice and consent" of the Senate. In practice, this translates into requiring Senate approval ("confirmation") of appointees.
A former (two-term) President is not barred from serving in a cabinet position simply because they are ineligible to become President. In fact, persons ineligible to hold the office of President are allowed to hold cabinet secretary positions. Although these offices are in the line of succession to the Presidency, ineligible persons are skipped if succession ever gets to their office. At the time of this writing, the US Secretary of the Interior, Sally Jewell, is an example of this practice. (See, for example, https://en.wikipedia.org/w/index.php?title=United_States_presidential_line_of_succession&oldid=739075188#Current_order). Although the Secretary of the Interior would normally be number 8 on the list, right behind the Attorney General, as long as Jewell holds the office and is ineligible, the order skips to the Secretary of Agriculture.
Finally, for completeness, I'll note that there seems to be some dispute over whether former Presidents are ineligible to serve as President, or merely ineligible to be elected President (i.e., making them eligible to rise to the office through succession) See, for example, the discussion in the National Review for the sort hair-splitting that this issue generates. For purposes of this question, it doesn't matter; either way a former President could be appointed to a cabinet position without running afoul of term limits to the Presidency.
William Howard Taft was President of the US, then later appointed to the Supreme Court (not an Executive position, yet still somewhat relevant). This was before the 22nd Amendment, but I wouldn't think that matters.
Although not prohibited, as a practical matter, this could create problems. If Hilary Clinton were to appoint Barack Obama to a post in her Cabinet, there might be a risk that he would "outshine" her, since he was President for 8 years, and she's the newbie.