"Get Hard," out in US theatres on Friday, sees hapless millionaire James King (Ferrell) charged with fraud and given 30 days to prepare for prison.
He turns to Darnell (Hart), a car-wash entrepreneur, to get him ready for life behind bars.
James assumes Darnell, a African American, is an ex-convict. Darnell, a middle-class family man with no hint of a criminal record, goes along with the assumption because he needs the money.
"(James) lives in such a bubble and doesn't know how to talk to human beings, and (Darnell) is able to break me down and rattle my cage and say, 'This is what the real world's like'," Ferrell said in an interview at the South by Southwest Festival in Austin, Texas earlier this month.
Ferrell and Hart candidly discussed racial caricatures at a time when race is still a hot button issue in the United States.
"We're poking fun at these racial stereotypes in such a clever way that people are going to have to go, 'It is stupid to prejudge and to assume based on appearance, colour, standards, whatever it may be'," Hart said.
Race is "just something I think we always need to analyse," Ferrell added. "It's healthy to talk about it, and it bridges or creates the bridge toward acceptance."
Time Warner Inc-owned Warner Bros' "Get Hard" will battle young adult dystopian drama "Insurgent" this weekend and is projected by BoxOffice.com to earn $31 million at the US box office.
Much of the film revolves around prison rape jokes as Darnell pushes James' comfort level to get him into shape for jail.