Good question. There are many factors, I am sure even formulas. But in my limited experience, the management and board start with the traded price and discount it enough to make it more worth while to buy from the company than other investors. There is debate and such.
Perhaps one of our mbas here can answer this better than I.