In various formulae for black-body radiation where $c$ appears, there is an implicit index of refraction dependence, since $c=c_0/n$, where $c$ is the speed of light, $c_0$ is the speed of light in vacuum, and $n$ is the index of refraction into which the blac kbody is radiating. This comes up, for example, in Planck's law, the Stefan-Boltzmann law, and Wien's displacement law.$^1$
I find this observation surprising, because it implies that black bodies radiating into $n\neq 1$ materials emit a factor of $n^2$ more power than otherwise identical bodies emitting into vacuum.
To me, it seems that this would violate the laws of thermodynamics. Consider the situation where two black bodies of equal area face one another. Suppose that the gap between the two black bodies is partly filled an index-$n$ material, with one black body in contact with the index-$n$ material, and the other surrounded by vacuum. Then, according to the argument of the preceding paragraph, one of the black bodies will radiate $n^2$ more power than the other. If the two black bodies are thermally isolated from the rest of the universe, then they will equilibrate to different temperatures. As I understand it, this violates the zeroth law of thermodynamics.
There must be something wrong with the above argument. None of my books mention an $n$-dependence, so at first I thought that perhaps the $c$ in Planck's law actually indicated what I call $c_0$, the speed on light in vacuum. However, this does not seem to be the case; I've found at least one reference that explicitly mentions this $n$-dependence.: "For radiation into a medium within which the speed of light is not close to $c_0$, [Planck's law] must be modified by including an index-of-refraction multiplying factor."
How is the index of refraction dependence in Planck's law compatible with thermodynamics?
$^1$ The $n$ dependencies in the Stefan-Boltzmann law and Wien's displacement law follow from the one in Planck's law, whereas the two former can be derived from the latter.