Primo Levi uses the concept of the "gray zone" in his book of essays The Drowned and the Saved to illustrate the position of concentration camp prisoners and other targets of Nazi oppression who assisted Nazi authorities. In the book's preface, he says:
Every victim should be mourned, and every survivor should receive assistance and compassion, but not all their behavior can be held up as an example. Inside, the camps were a tangled and multilayered microcosm. There was nothing subtle about the “gray zone,” which I shall discuss further on, the zone of prisoners who, to some extent, maybe for worthy purposes, had collaborated with the authorities; indeed, it represented a phenomenon of fundamental importance to the historian, the psychologist, and the sociologist. There is no prisoner who does not remember it, who does not remember the shock he felt when the first threats, the first insults, the first blows came not from the SS soldiers but from other prisoners, “colleagues,” mysterious characters who were wearing the same black-and-white striped pajamas that they, the new arrivals, had just put on.
(trans. Michael F. Moore)
This zone is gray because such prisoners defied black-and-white categorization. As Levi saw it, the existence of such "inmate-functionaries" defies attempts to strictly dichotomize the concentration camp experience; these individuals were pressed into such compromises, but they compromised nonetheless and received privileges accordingly, however small and faint. Levi assesses these individuals at varying levels of coercion and personal responsibility, but refrains from a polarized judgment; among others, he places in the gray zone the Kapos, inmates who served as the heads of inmate work squads and who were at liberty to punish the inmates under their command as they saw fit. Some imprisoned individuals were employed by camp officials on a menial level and possessed little power or advantage over their fellow inmates; others had greater responsibilities within the camps and were able to leverage that responsibility, however tenuously, or received fleeting rewards in exchange for the performance of extraordinarily terrible duties, like the individuals tasked with assisting Josef Mengele or the Sonderkommandos who operated death-camp crematoria.
Levi's essays draw on his own experiences at Auschwitz as well as those of other prisoners like Miklós Nyiszli and Filip Müller; Müller's book Eyewitness Auschwitz: Three Years in the Gas Chambers and Nyiszli's Auschwitz: A Doctor’s Eyewitness Account are both referenced in the essay. The 2001 film The Grey Zone which draws its title from this chapter also draws from Nyiszli's accounts of the experiences of Sonderkommandos.
You might be interested in these past threads:
"What were the safest "positions" as a Jewish person during the Holocaust in a camp?" answered by /u/commiespaceinvader
"Were there any documented cases of Holocaust survivors developing Stockholm Syndrome?" answered by /u/commiespaceinvader
"Were any Jewish kapos tried for war crimes?" answered by /u/kieslowskifan