If Joel and Ethan Coen teamed up with Christopher Guest to make a dark comedy about a murder in a small East Texas town, it might resemble “Bernie,” written and directed by Richard Linklater and based on a true story.

Actually, I may have oversold it. The hypothetical Coen/Guest collaboration would probably be more substantive and incisive than “Bernie,” which offers laughs but stays at the shallow end of the pool. Set in Carthage, Texas, it tells the tale of a beloved, probably-gay mortician named Bernie (Jack Black) who befriends the most hated woman in town, mean old widow Marjorie Nugent (Shirley MacLaine). Does he have ulterior motives for this, or is Bernie simply a kind man who likes everyone?

Documentary-style testimonials from plain-talking townsfolk add tremendous Texas flavor, and Linklater’s affection for them is clear. His affection for Bernie, Marjorie, and district attorney Danny Buck Davidson (Matthew McConaughey, riffing on the slicker lawyers he has played) is less evident — that’s where you see the Coens’ influence — though the outsized characters are fun to laugh at.

Frustratingly, Jack Black’s refusal (or inability) to fully commit to a character without winking at the audience is a hindrance. Bernie is supposed to be a sincere oddball, a fey pixie who earnestly believes in the funeral products he so capably sells to grieving families. But the way Black plays him, he comes across as a smarmy huckster — a serious detriment to a story that hinges on the question of whether Bernie is good or bad. A more authentic leading performance would boost the film, but even as it stands it’s irreverent, off-kilter fun.

B (1 hr., 44 min.; PG-13, some profanity, one F-word, a couple of violent images.)