Question: has a democrat ever won the electoral college but not the popular vote

Answer: Yes, In the 1888 election, Grover Cleveland of New York, the incumbent president and a Democrat, tried to secure a second term against the Republican nominee Benjamin Harrison, a former U.S. Senator from Indiana. The economy was prosperous and the nation was at peace, but although Cleveland received 90,596 more votes than Harrison, he lost in the Electoral College. Harrison won 233 electoral votes, Cleveland only 168.