Elucidating Mechanisms of Demographic Bias in LLMs for Healthcare