Capitolism is the impediment. Communism is Star Trek's answer to this problem. Don't be offended... these are economic terms, not political. Thru the years, their meanings have become misconstrued.
The brand of Communism as it exists in Trek can only exist in a "Post Scarcity environment" Ie. Cheap replication technology and abundant energy production.
That would involve robotics, near free energy and technology that can take molecules of dirt and re-organize it into other substances, structures and other stuff.
Basically Poop to Boots level tech....