The basketball team earned 50 x $2 = $<<50*2=100>>100 from selling cupcakes.
They also earned 40 x 0.5 = $<<40*0.5=20>>20 from selling cookies.
So their total earnings was $100 + $20 = $<<100+20=120>>120.
The two basketballs cost $40 x 2 = $<<40*2=80>>80.
Thus, $120 - $80 = $<<120-80=40>>40 was used to buy the 20 bottles of energy drinks.
Therefore, each bottle of energy drink costs $40/20 = $<<40/20=2>>2.
#### 2