This really depends on the retail methodology of a company. Space allocation in a category planogram (layout) is often ultimately decided by the category manager (corporate person who is responsible for P/L of that category), but can be affected by the heavy hitters in that category using their internal "retail services" department to help said category manager formulate their planograms. This usually results in somewhat biased product assortments and layouts that give preferential treatment to specific brands, but rarely is space outright purchased within the aisles of a store.
End-caps are a different story, but often the "purchase" of an end-cap simply takes the form of wholesale pricing concessions, which allow the store to make more money by promoting those products for a short period of time. Historically, some DSD brands will lease end-caps at stores (speaking specifically about supermarkets in this context), but these are serviced and stocked by external companies. Depending on the marketing strategy of a chain, private label products are often placed on end-caps to drive volume for what are often their highest-margin products (due to heavy control over the whole supply chain) and are not subject to any purchasing.
TL;DR:
The extent to which retail stores "sell" shelf-space is often exaggerated, a kind of folk wisdom that may have been more truthful in the past but doesn't reflect modern business practices.