has a president ever been elected by popular vote
The 1876 presidential election was one of the most contentious and controversial presidential elections in American history. The result of the election remains among the most disputed ever, although there is no question that Democrat Samuel J. Tilden of New York outpolled Ohio's Republican Rutherford B. Hayes in the popular vote, with Tilden winning 4,288,546 votes and Hayes winning 4,034,311. Tilden was, and remains, the only candidate in American history who lost a presidential election despite receiving a majority (not just a plurality) of the popular vote.
United States presidential elections in which the winner lost the popular vote