Because they charge as much for a cup of coffee as McD's does for a burger!
That's part of the answer.
Starbucks owns coffee plantations, harvesters, washing stations, warehousing and roasters.
They have $1.20-$2/lb in the coffee that they sell for $12-16/lb. More than that in profits when they sell it by the cup.
The vinyl bags cost as well as the R/M on the equipment.
Green coffee of the specialty classification sells for up to $4-6/lb....Starbucks uses a more institutional grade bean in most instances even when single sourced. These are machine harvested...not by Juan Valdez picking one cherry at a time.
Then washing and drying and sorting is done by computer controlled equipment and then roasted to remove any sourness and leave nothing but bitterness behind.
(Yes its burnt and no special notes are left...on purpose to keep it standardized)
Then today it's a fully automatic machine that leaves no room for artistry for the barista.
A good espresso shot it perfectly dosed, compressed to exacting standards, then the hot water is at a specific pressure and volume through the "puck" for a specific time creating a very exacting volume of espresso.
It requires time and practice for a barista to become competent at this to create a quality espresso based drink.
Starbucks has replaced baristas with glorified button pushers. And standardized their coffee into monotonous crap.
About half of your independent coffee shops will make a better coffee than any Starbucks ever thought about today.
Including chains known as Kaldi's or Bongo Java. Good coffee requires a craftsman. Pure and simple. Kaldi's understands this and they have semi-automatic machines. Miles better than volumetric or fully automatic machines that Starbucks uses.