A few reasons:
1. Obama was immensely popular among Blacks, and Mitt Romney was practically tone-deaf to the Black community; there was one Detroit-area community of 1500 voters where I think Romney got 5 votes, and may have gotten as few as 0 (I don't recall).
2. Obama was not popular among white Southerners or rural whites; some trends which made themselves obvious in 2016 were already in progress in 2012.
I'm not sure 2012 was the peak year for the racial divide; I think 1984 is a strong contender, with Reagan winning 65-66% of white voters and 8-10% of Blacks (Detroit's Black districts gave Mondale between 95.9% and 97.2%).
I fully agree with all of these. 1984 is probably the best contender for the worst racial gap. Reagan
did indeed win 66% of the white vote, while Mondale won blacks 91-9% and Hispanics 66-34%. Mondale did better than any Democrat since him has done among black voters with the obvious exception of Obama, and he did about as well as H. Clinton and Biden did among Hispanic voters. Reagan did worse with black voters then in 1980; that year, Carter had won them
83-14-3%. He did worse then Ford and Nixon as well, and only marginally better than Goldwater in 1964. Black voters despised Reagan (to put it mildly).
As I've noted elsewhere, I watched the 1980 NBC News reports on that year's election, and one of them, from July or August 1980, featured Reagan visiting the heavily black and inner city areas of New York City (or it may have been Detroit; I can't exactly remember). He had a very hostile confrontation with a group of black voters protesting his visit, and engaged in a shouting match with a black woman who was heckling him, claiming that he was trying "to help" them. After winning the election, Reagan gave up any attempt to appeal to black voters, and his administration's policies, wiping out what remained of the Great Society, catering to white conservatives from the South, ignoring the HIV/AIDs epidemic (which disproportionately affected blacks), and intensifying the Drug War (i.e. Nancy Reagan's "Just Say No" campaign), contributed to black distaste for him. And of course, Reagan initially opposed making MLK Day a holiday, was closely connected to virulent former segregationists such as Strom Thurmond and Jesse Helms, and had given his infamous "State's Rights" speech in Philadelphia, Mississippi-all of which reflected poorly on him with blacks.
Reagan's poor performance among black, Hispanic, and Native American voters had hardly any effect on the 1984 results, as the country was
far less diverse back then (86% of the electorate was white in 1984). Asian voters leaned Republican back then, and were probably the only minority group that Reagan did well with that year.