When I am buying BTC f-to-f, by cash how can I know all the outputs of the senders's wallet are from legal sources?
No. Most of the deposits would be sourced from unidentified sources anyways one way or another, because they all come off exchanges. Can you say for sure that the coins that you receive on Binance or whatnot that you deposit to CEX is going to be 100% legit? Probably not.
But I think that the point is that you are able to show where your funds are from, and keep records of your purchase at LBC, so that if they do ask you for anything, you've got sufficient proof that you've done your due diligence. If you can ensure that your funds are legit, then there is absolutely nothing to worry about.
Of course, there is a risk at any exchange given that they write it in their ToS that they reserve the right to freeze your account if they suspect anything and ask for proof of funds. That's the risk that you're faced with every time you use a centralized service, can't do anything about it.