Assuming fruit has an id column, you need:
select sum(p.numberPurchased * f.price) from fruit f join purchase p on f.id = p.fruitId;
You can omit prefixes (p., f.) if the field names do not repeat.