For this case, the first thing we must do is define variables:
x: cost of each basketball
y: cost of each soccer ball
We now write the system of equations:
6x + y = 27
4x + 2y = 22
Solving the system we have:
x = 4 $
y = 3 $
Answer:
basketballs cost $ 4
soccer balls cost $ 3