Same product in several companies, different cost

Same product share among companies, each one has their own cost, stock, how to restrict access and view stock, cost of each company only for user of the corresponding company

Maybe you can use user permissions to restrict permissions based on company?

https://frappeframework.com/docs/user/en/basics/users-and-permissions#user-permissions

https://docs.erpnext.com/docs/user/manual/en/user-permissions