The University of Wisconsin-Madison last academic year spent $23.5 million to counter job offers and hang on to a growing number of faculty who had opportunities to leave, and most of that money came from federal funding that supports research overhead and the university’s private research foundation, according to university officials and a report released Friday.