Back in the day when I played Star Trek tabletop RPGs we postulated that the technology on Kirk's Enterprise and any earlier ships (remember this is early TNG era we're talking!) were mechanical in nature. The food was prepared below in a kitchen and delivered via a system of penumatic tubes and micro-turbolifts. Later ships had the food beamed into the slots instead of the cumbersome and cranky mechanical systems.
Around the period of what would be TOS Season Four/Five and prior to TMP an experiment took place to convert inorganic matter into organic matter using a novel energy transformation wave pattern. The project was ultimatly abandoned when it was found to be unstable on a large scale... however the lessons learned in Project Genesis Phase One led in just a few short years to the ability to re-arrange matter on a small controled scale.
While it wasn't possible to make a solar system, it was possible to create tea... earl-grey... hot.
Mind you that was from our RPG and strictly non-canon and the product of my imagination.