Here is the solution to this problem: basic income for all, fixed prices for all the products needed for a healthy and confortable life, creation of money without interest rate, and birth control.
The cost value assigned to a product is fictitious, and it only represents the will and ambition of its seller to increase their wealth. The so called cost of a product is nothing more than the sum of all the ambitions of all the sellers that created all the intermediate products that were necessary for that product's creation.
Therefore, in order to fix the various social problems we face, including the one of AI removing the need to work, we must fix the prices of products so as that they include a standard amount of profit.
Then we can give a basic income to all, which covers the basic needs for the fixed prices defined above.
People will still be able to get rich, by the quantities of the products they sell, not by manipulating the prices of products.
The next step is to eliminate interest rate when money is created. When a banker pushes a button to create money, he assigns interest rate to it. This leads to money devaluation over time and increased value of wealth. It is a big source of misery, because the money was created out of thin air and the banker shall have no profits from it. Banks shall only be allowed profit on lending existing money.
Finally, a worldwide policy of birth control should be implemented in order to stabilize the world population.