According to Khan Academy, the answer to your question is yes, the energy of the photon emitted during a transition from one energy level to another in a hydrogen atom is directly related to the energy difference between those two levels.
In the case of a transition from level n=2 to level n=1 in a hydrogen atom, the energy of the emitted photon is equal to the energy difference between these two levels. This energy difference is given by the formula:
E=(13.6 eV)(1/nlow21−1/nhigh21)
where nlow and nhighare the principal quantum numbers of the lower and higher energy levels, respectively1. In this case, nlow=1 and nhigh=2.
So, the energy of the photon emitted during this transition is directly related to the energy of the hydrogen atom in these two states.