Never heard of liberation theology?
King probably wasn't a Marxist, but as instated before, he had a critical opinion if capitalism and wasn't anti-communist in any sense.
A quote from his autobiography:
"I was deeply concerned from my early teen days about the gulf between superfluous wealth and abject poverty, and my reading of Marx made me ever more conscious of this gulf. Although modern American capitalism had greatly reduced the gap through social reforms, there was still need for a better distribution of wealth. Moreover, Marx had revealed the danger of the profit motive as the sole basis of an economic system: capitalism is always in danger of inspiring men to be more concerned about making a living than making a life. We are prone to judge success by the index of our salaries or the size of our automobiles, rather than by the quality of our service and relationship to humanity - thus capitalism can lead to a practical materialism that is as pernicious as the materialism taught by communism.”
“In short, I read Marx as I read all of the influential historical thinkers - from a dialectical point of view, combining a partial ‘yes’ and a partial ‘no.’ In so far as Marx posited a metaphysical materialism, an ethical relativism, and a strangulating totalitarianism, I responded with an unambiguous ‘no’; but in so far as he pointed to weaknesses of traditional capitalism, contributed to the growth of a definite self-consciousness in the masses, and challenged the social conscience of the Christian churches, I responded with a definite ‘yes.’ “