  The primary dissipation mechanism in jets of gamma-ray bursts (GRBs), and the
high efficiency of the prompt emission are long standing issues. One
possibility is strong collimation of a weakly magnetized relativistic jet by
the surrounding medium, which can considerably enhance the efficiency of the
photospheric emission. We derive a simple analytic criterion for the radiative
efficiency of a collimated jet showing that it depends most strongly on the
baryon loading. We confirm this analytic result by 3D numerical simulations,
and further find that mixing of jet and cocoon material at the collimation
throat leads to a substantial stratification of the outflow as well as sporadic
loading, even if the injected jet is uniform and continuous. One consequence of
this mixing is a strong angular dependence of the radiative efficiency. Another
is large differences in the Lorentz factor of different fluid elements that
lead to formation of internal shocks. Our analysis indicates that in both long
and short GRBs a prominent photospheric component cannot be avoided when
observed within an angle of a few degrees to the axis, unless the asymptotic
Lorentz factor is limited by baryon loading at the jet base to $\Gamma_\infty
<100$ (with a weak dependence on outflow power). Photon generation by newly
created pairs behind the collimation shock regulates the observed temperature
at $\sim 50~\theta_0^{-1}$ keV, where $\theta_0$ is the initial jet opening
angle, in remarkable agreement with the observed peak energies of prompt
emission spectra. Further consequences for the properties of the prompt
emission are discussed at the end.
