How to get MIN, MAX and DIFFERENCE among rows with the same value in a certain column
In addition to other answers - and to make it clear that subqueries or CTEs are not needed here. We can have the same result without them. Use whatever is more clear to you:

select
     s.store_id,
     max(s.rating) - min(s.rating) as difference,
     min(s.rating) as min_rating,
     max(s.rating) as max_rating
from
     storeRatings as s
group by
     s.store_id
  ;