You can create and own whatever company you wish. You are not allowed to work for it while you're under H1B issued to you by a different company, even if it's done without compensation, just like you're not allowed to "volunteer" working for a third company in a position that would otherwise be performed for compensation.
I did but I had to subsequently quit the company sponsoring my visa and my new company petitioned for a new one. During this time I left the US.
Note that you have to demonstrate the new company isn't just a front to keep you in the country. It helps to have co-founders, other employees, revenue, etc and helps if you don't have a controlling interest.
My understanding is that in the US, an H1B worker can not work for his/her own company. I had an employee once that had done this, and he was on the verge of getting in trouble with the INS. What's worse, is that he couldn't just "quit" his company and get hired by someone else, because his Visa wouldn't transfer. So in order to hire him, I actually had to acquire his company so that the paperwork all worked out.