PITTSFIELD, Mass. — In 2012, Jack Phillips, a Colorado baker, citing a religious objection to same-sex marriage, declined to make a wedding cake for David Mullins and Charlie Craig. It took six years for the resulting case to be resolved — and then only narrowly — by the Supreme Court’s decision in Masterpiece Cakeshop v. Colorado Civil Rights Commission last month.

It took the playwright Bekah Brunstetter substantially less time to write “The Cake,” which riffs on that case, and to see it produced around the country. Since its premiere at the Echo Theater Company in Los Angeles in June 2017, it has been staged in La Jolla, Calif., Chicago and Houston, among other cities, with a New York production scheduled for the Manhattan Theater Club in February.

I caught “The Cake” at the Barrington Stage Company here, during a recent Berkshires visit that also featured, 20 miles to the north at the Williamstown Theater Festival, Douglas Carter Beane’s “The Closet.” Different as they are — “The Cake” is intimate and touching, “The Closet” big and blaring — both set out to address timely issues of gay life and representation.

“The Cake,” which runs through Sunday, is not only more successful at that than “The Closet,” it’s more successful than the Supreme Court. Of course, that’s partly because the justices could not invent the facts of their case the way Ms. Brunstetter could. Her version, you might even say, is rigged: posing the problem in an extreme way to shift the focus from principles to people.