Let \( j \) represent the cost of one jar of jam and \( p \) represent the cost of one pie. We can formulate the following two equations based on the purchases made by Miles and Emma.
From Miles' purchase, we have: \[ 5j + 2p = 37.50 \]
From Emma's purchase, we have: \[ 4j + 3p = 40.50 \]
Thus, the system of equations is: \[ \begin{cases} 5j + 2p = 37.50 \ 4j + 3p = 40.50 \end{cases} \]