I have been several times in Dallas and those shelves are pretty common in Marriott and Starwood hotels. The first reason why you see those is because a lot of them are business type of hotels. So you mostly have solo travelers and they prefer to eat something quick in their room rather than taking the car to go out to a restaurant. Usually, those hotels don't have a restaurant in house, they only offer breakfast.
Then, it is always paying. The exception is the club lounge in some of those hotels where you can have "free" food but this is available only for higher room categories or loyal customers.
The price of the items available in the shelves is usually displayed upfront or on small stickers directly on the items. As mentionned, you can book it directly to your room if you don't have money. The good thing is that it goes far beyond food, you can also find a lot of travel items that can help making your travel better, especially if you have forgotten something at home.