While the stereotypes in “Get Hard” may be gross exaggerations, its characters live in the real world: A place where the chasm between rich and poor is vast and growing; where black men are disproportionately jailed and white-collar criminals often evade punishment.

In this New Orleans-filmed comedy from first-time director Etan Cohen, James (Will Ferrell) is a Los Angeles millionaire hedge-fund investor whose life of indulgence and ignorance is interrupted by a surprise prison sentence for fraud. He turns to the guy who runs the company car wash, Darnell (Kevin Hart) — apparently the only black person he has ever met — and asks for help to prepare for 10 years in maximum security. Darnell has no jail experience, but he agrees because he needs money to buy a home in a better school district for his little girl.

When Darnell’s wife, Rita (Edwina Findley Dickerson) — the film’s only voice of reason — asks what he did to give the impression he had a criminal record, he replies, “I was being black.”

Darnell’s pre-jail prep class includes transforming his student’s Bel-Air mansion into a pretend prison, the household staff gleefully becoming its guards. Lessons include getting James in shape, teaching him how to fight and encouraging him to practice oral sex on men.

The first yields some laughs as the 6-foot-3 Ferrell uses the diminutive Hart as a barbell. But forced sex isn’t funny, no matter who’s doing the forcing or the gender of the parties involved. “Get Hard” traffics in other crude humor involving more than one look at Farrell’s naked tush and a tiring amount of puns on the film’s title.

Darnell knows one real ex-con, his cousin Russell (an ultra-charismatic Tip “T.I.” Harris), whom he turns to for actual help for James behind bars. James hits it off with Russell and his gangster pals when he shows them how they can “liquidate two bricks of cocaine” into hedge funds to make more money.

“Wall Street, man. Those are the real criminals,” one gangster says.

Right. This is supposed to be a parody of the One Percent.

The film is guilty of occasionally underlining its jokes like this. James even uses the phrase “teachable moment” after a heated racial encounter — and not ironically.

Stars and producers of “Get Hard” defended the film after its premiere at South by Southwest last week, where some viewers and critics called it racist and homophobic.

So when does satire become an expression of the very sentiment it hopes to ridicule?

James’ initial bias against blacks is overt. He’s afraid of Darnell when they first meet, and openly assumes he has been to jail because of his race, citing the statistical likelihood. That can work as satire.

But when Darnell misses all of James’ literary references, is that satire, or is it racist and classist?

James has two female love interests, one white and one black. The black woman does more twerking than speaking on screen. Does that satirize a racist and sexist stereotype, or reinforce it?

It’s tricky territory to tread, and “Get Hard” doesn’t always get it right, but in a nation where racial and economic divides are growing issues, it deserves credit for trying. The film stays afloat on the goofy charm of its two leads, a great soundtrack with music from Nicki Minaj, T.I. and The Pharcyde, and an undercurrent of truth.

Los Angeles is a real reflection of economic disparity, from the Colosseum-like grandeur of James’ Bel-Air home to the magnetometers in front of (fictional) Lower South Central elementary school. The country really does have a prison problem, jailing more of its citizens than anywhere in the world, black men at six times the rate of whites.

One of the biggest leaps here is that a wealthy Wall Street scoundrel would be facing hard time.