But what if you end up "working" for your company? Let's assume that you are in the US and might have to put in hours to hack together a product or a service. And none of your "employees" are in Latvia or Belize. Is it still legal?
It's legal, but you increase the odds that the IRS might pay extra attention and consider whether the company is de-facto US. I don't know US regulations in that respect, but many countries give tax authorities wide latitude in determining that an entity is due tax in their country even if it's not incorporated there.
Note, though that theres still nothing illegal with it (unless you try to explicitly hide what you're doing) - it may "just" impact your tax bill.
If the company hosts it's service in Europe, sells to European customers and otherwise does not have much of a footprint in the US, chances are good they'd accept that the company is foreign.
Of course any income he takes out - whether salary or dividends - will still be taxable in the US (subject to any tax treaties if he were to do the work in the EU too).
I'd imagine that strictly speaking one would have to register the foreign company with the secretary of state as a branch or foreign company, if certain conditions were met.
Sure. Incorporation and where you do business are two completely different things. It's all legal as long as you comply with regulations of all involved countries.
Good question. It's not clear where there data source is coming from (well, their own service, but where is that coming from?). Data source is important: Using craigslist for instance will ignore tons of places on the low end causing distortions.