The important thing to always remember is that you must maintain a separation in your mind between you as individual(s) and the company. Think of the company as a box. Inside that box are assets (e.g. cash, real estate, income-generating contracts) and maybe liabilities (e.g. unpaid bills, loans). The value of the box is what someone else (e.g. someone participating in the stock market) is willing to pay for the combination of everything that is inside the box. If the assets are worth $2 and the liabilities are $1 then the box is worth $1.
A share represents ownership of a part of the box. In practice there are different types of shares with different types of rights but let's assume we are talking "ordinary shares" which give full and proportionate rights to the portion of the company that they represent.
Let's say your company starts with 100 shares, assets of $2, and liabilities of $1 (so that it is worth $1 altogether):
---------------------
Daniel --- 100 shares (100%) ---> | Assets = $2 |
| Liabilities = $1 |
| Value = $1 |
---------------------
In this case, your 100% ownership of the company is worth $1.
Now your friend approaches you and says "I want to put $1 into the company and I want us to own 50% of the company each". What happens is that the company issues an additional 100 shares to your friend, and he pays $1 in to the company in return for those shares. That $1 goes into the box:
---------------------
Daniel --- 100 shares (50%) ----> | Assets = $3 |
| Liabilities = $1 |
Friend --- 100 shares (50%) ----> | Value = $2 |
---------------------
You now each own 50% of a company which is worth $2, so your shares are worth $1 just as before.
"But this can be seen as me selling 50% of my company for 1 USD (which will mean my company was worth 2 USD, instead of 1)"
The reason that this is wrong is because at no point did you "sell" 50% of your company to your friend. You still have the 100 shares that you owned before. Nothing was sold. Instead, the company was increased in size and new shares were created for your friend which represent the increased "part" of the company. You can think of this new part as being an extra box with $1 inside it which your friend "glued" on to the original box to make a bigger box:
-----------------------------
Daniel --- 100 shares (50%) ----> | Original company = $1 |
-----------------------------
Friend --- 100 shares (50%) ----> | New part of company = $1 |
-----------------------------
The value of your friend's shares represents the new part that they added by investing the $1 into the company, and your shares represent the $1 that was already in the company.
"Owner: My company is worth 1 USD. Rich Guy: Fair, I´ll buy 50% for 0.5 USD. We can use these 50 cents to buy inventory. The company is now worth 1.5 USD, but each didn´t contribute equally."
Normally in this type of scenario the Rich Guy really means he will invest $0.50 into the company (in which case the scenario above applies), so the word "buy" in your sentence is incorrect. However, let's pretend that instead of the original scenario, your friend will in fact buy 50% of the company for $0.50. "Buy" means that he will buy it from you instead of investing into the company. Now the new diagram looks like this:
---------------------
Daniel --- 50 shares (50%) -----> | Assets = $2 |
| Liabilities = $1 |
Friend --- 50 shares (50%) -----> | Value = $1 |
---------------------
Here, instead of your friend getting 100 new shares (and you keeping your original 100 shares) as happened in the first scenario, you've given 50 of your shares to him. Notice that in this new scenario the company is worth exactly what it was when you started ($1). That's because your friend did not put any money into the company. Instead, he gave you $0.50. That money is in your pocket, not inside the box. He gave you $0.50 and now you own shares worth $0.50 and he owns shares worth $0.50. The part where you say "The company is now worth 1.5 USD, but each didn´t contribute equally." is wrong because the company is not worth 1.5 USD.
If you want to take Rich Guy's suggestion and use the $0.50 to buy new inventory, then because that $0.50 is in your pocket, you will need to lend it to the company so that it can buy the new inventory. In that case the company's value is exactly the same as before. That's because its assets (in the form of cash) have gone up by $0.50, but its liabilities (in the form of money owed to you) have also gone up by $0.50, resulting in no net change:
-----------------------
Daniel --- 50 shares (50%) -----> | Assets = $2.50 |
| Liabilities = $1.50 |
Friend --- 50 shares (50%) -----> | Value = $1 |
-----------------------
Scenarios of the first type (where money is invested into a company) is known as equity financing and usually takes the form of shares. Scenarios of the second type (where money is lent to the company) is known as debt financing and usually takes the form of loans or bonds. They are both common methods but are different to each other, and you need to be clear which you are using if you want to understand the resulting valuations of your stake and the company.