Since you don't know how much Tanny paid, assign a name to that quantity.
The letter $x$ is a good choice. Then $x$ is the unknown value you want to
find out.
Take the way you would have calculated John's loss and Tanny's profit
if you had known the price Tanny paid, but use the symbol $x$ instead
of a known price.
Write out the calculations of how much John lost (as a percentage of
his cost, which was $540,000$) and how much
Tanny gained (as a percentage of his cost, which was $x$).
You will not be able to get a simple numerical percentage out of these
because of the unknown value $x$, but you will have two expressions
involving some known numbers, the unknown $x$, and some operations,
each representing a percentage.
The "is equal to" part of the problem tells you these two
percentages are equal. So you can put them on each side of an $=$ sign.
Now you have an equation, and the only unknown quantity in the equation
is $x$. You have to solve for $x$.
Hint: If the first step goes OK, on one side you'll have a fraction that is kind of ugly because it has $x$ in both the numerator and the denominator. You may want to recall rules such as cross-multiplying so you don't have an $x$ in a denominator.
Second hint: you'll probably end up wanting to solve a quadratic equation in order to finish.
It will be harder to follow these hints than if I had written out all
the formulas explicitly. What I'm trying to do here is to explain a little
of what would go through my head when looking at a problem like this,
and how I would get past the "what does this question even mean?" phase
and get something I could actually use some math to solve.