If you are German then no one should have told you there's no possibility of freelancing, but it might make more sense to first take on enough Swiss customers freelancing from Germany, or as a commuter to Basel, etc. I would just recommend being conservative about maintaining a reasonable/stable salary sourced from Switzerland when renewing a residence permit.
If you really mean contractor gigs from abroad, everyone I met doing that actually works permanently for a placement agency, and most of them are not very nice. IMO it is just as easy (or hard) to find a job directly and better.
I tried directly and also over an agency, but in both cases the requirement was to hire me, with the previous mentioned "limitation". Since I had no clear source of information, I gave them credit and didn't pursue the matter. Even if the money was really really good ( 10k+ euro monthly ).