I think that some of the lessons learned by Edward and Tom are moral lessons.
I believe that one lesson that both boys learn is to not make immediate, snap judgments based on only outward appearance. In other words, they learn that it's unwise to "judge a book by its cover." Both Tom and Edward make initial assumptions about the other person and the life that he lives. Both boys initially assume that the other person has certain advantages. They each believe that the grass is greener on the other side of the fence. That's why the idea of changing places is so appealing.
"Oho, wouldst like it? Then so shall it be. Doff thy rags, and don these splendors, lad! It is a brief happiness, but will be not less keen for that. We will have it while we may, and change again before any come to molest."
However, after switching places, both boys realize that their initial thoughts were erroneous. They have learned that each of their lives come with both advantages and disadvantages.
I believe that another lesson both boys learn is a lesson about power and responsibility. Throughout the novel, Edward is bombarded with the injustices created by his father. As he matures, Edward realizes that his royal position can be used for more than selfish gain. He realizes that he can use his position to help other people. He learns the same lesson that Peter Parker's uncle tried to teach Peter -- "With great power comes great responsibility."
The king was cheerful and happy now, and said to himself, "When I am come to mine own again, I will always honor little children, remembering how that these trusted me and believed in me in my time of trouble; whilst they that were older, and thought themselves wiser, mocked at me and held me for a liar."