Why do prison gangs exist? Despite the prominence of formal governance mechanisms, inmates also require self-governance institutions to facilitate illicit trade. This article examines how inmates enforce agreements in the illicit contraband trade and how they resolve social disputes. We first describe how the informal prison society operates as a community responsibility system. We then present a model of prison gang organization that accounts for both environmental factors and the endogenous actions of the prison administration, encapsulated in the "warden." We find that gangs organize based on exogenous characteristics. The "warden" diffuses gang influence by maintaining the oligopolistic structure, which limits contraband but allows for orderly private allocation of prison-provided goods and dispute resolution.