Yes, and this would really be awful in the short term, but in the medium term medicine companies would just spin up more production until the "very wealthy people" demand has been met and medicine becomes available again at some reasonable price.
The fact that this is very likely prevents most of the speculation in the first place.
The difference with real estate is that the owners get to determine production levels, via local zoning laws.
Sure, there is some natural scarcity: Land cannot be created, but in most cases artificial scarcity is the issue.