This is a long-standing debate over who should allocate capital. I don't think there's one exact answer. Clearly some companies, like AOL were terrible at reinvesting money, they tried and tried but wound up blowing tons of cash on worthless companies.
Other companies, like say Facebook were able to make smart investments like buying Instagram.
Clearly investors price stock based on whether the company can make smart investments in its own future, which is why AOL nosedived and Facebook rose. The market isn't always right but I'm not convinced that an alternative would be better