A hotel can have a website where people can directly book a room.
But people want to compare prices, shops around, hence a new form of ... middleman :D
If the hotel offered the lesser rate themselves, they would effectively be pricing their "free" amenities, and they don't want to do that.
Generally they are paying around 20% of the booking fee to the listing service. So in theory the hotel would be able to charge 15% less on their own site and make a larger profit. But if they did they would no longer get listed on the popular sites where people go to easily price compare and then book.
It's turtles all the way down.