This is going to take some considerable coding to accomplish creating something like this.
convert the templates to themes using Framework builder
Themes can be applied dynamically.
When the users purchases a site, you could create a global file in the site that would set session variables to control the theme that is used along with other settings like database connection settings.
To get familiar with framework builder themes, see the video on our you tube channel: