In my opinion if both parties know and they agree: is not immoral.
Note: we say
parties when referring to people, not "parts."
Marriage for love is a relatively recent practice, one of the many types of progress that followed the Industrial Revolution. And it's still not universal. A friend of mine from India just went home and married a woman who was chosen by his family.
He's lived here long enough to feel the culture shock of that. I was able to reassure him be telling him about my manager on my last job. He and his wife had an arranged marriage in India--25 years ago. His eyes teared up as he recalled it. He said, "I am so grateful to my parents for their wisdom. We fell in love during the three days we were given to get to know each other and agree to the wedding. If I had a thousand years to search, I could not have found a more wonderful wife than the one my parents found for me."
In earlier times marriages were arranged to strengthen community bonds, to resolve feuds, to forge political alliances, or to join complementary resources. Many of those couples fell in love and lived happy lives together. And we must acknowledge the fact that many of today's couples who fall in love before they get married eventually fall out of love and get divorced. My first marriage was a disaster, but my second is still going strong after 33 years. Divorce was virtually unknown except among the wealthy in previous times. Not because everyone was in love, but because the community would not allow a man to walk away from the responsibilities of his family. He would have to literally run away and become a sailor or something like that. The community would still consider the marriage intact, and being no fool he would play along with the ruse and send money home occasionally.
But if one party does not know?
I assume you're referring to the cliche of a person of ordinary means courting a rich person and pretending to be in love in order to marry him/her and become wealthy. You must think rich people are stupid and don't know what's going on. Stupid people don't stay rich very long, and this is one of the many ways they lose their money.
Besides, in any marriage between people from different economic strata, how can there not be at least a slight wistfulness for the comfort and security that comes with wealth? After all, anyone with an ounce of sense will stop and ponder what benefits and risks will accrue to them after marrying the person of their choice, and this can affect their decision. It isn't always money. What if the love of your life is famous and gets invited to great parties, or a drug addict who will be in rehab three months every year, or a talented backpacker who will take you on terrific vacations, or an arbitrator who goes into dangerous neighborhoods to resolve gang disputes? You can't help considering that before you make your decision.