Something like this can work, but only if several conditions are met.
As noted in the answer by JonathanReez, the ECJ has ruled that the member states can't impose further arbitrary restrictions on top of this, but it may already be hard enough to satisfy the basic ones.
First of all, any time you find yourself wondering about some aspect of cross-border work in the EU, you should take a look at the excellent Practical guide on the applicable legislation in the EU, the EEA, and Switzerland. It covers all you wanted to know (but were afraid to ask) about working across the borders of member states, and it's a much more pleasant read than the corresponding Regulation 883/2004. As usual, it's also available in all the official languages of the EU (just change the langId in the link above or go through this portal).
Your situation is covered by Part I: Posting of workers. This is defined as being sent by your employer to another Member State to temporarily perform work there for that employer, given that
- the duration of that work doesn't exceed 24 months, and
- there is a direct relationship between you and your employer during the whole period.
There are a few more conditions (eligibility of the employer etc.), but these are the key ones.
Now, depending on the specifics of your situation, you may already fail the first condition. Note that the 24 month limit is an upper bound, but it's up to the authorities of both states to decide if your posting is in fact "temporary". In practice, that usually means you'll work just on one particular project and leave as soon as it's finished (without anyone else being posted to replace you).
The second condition means that you have to prove that you're a real employee of the Czech company just providing some service to the German company, not someone working very much like a normal employee of the German company without following German rules.
Some (example) conditions that should be met to establish a direct relationship with your formal employer:
- only your employer was responsible for recruiting you
- only your employer can dismiss you (terminate your contract) or take disciplinary action
- you're paid only by your employer
- your employer determines the "nature" of the work you do ("not in terms of defining the details of the type of work to be performed and the way it is to be performed, but in the more general terms of determining the end product of that work or the
basic service to be provided")
In other words, you have to convince the authorities that your real boss sits in Czechia, not in Germany. If they get the impression that you're somewhat like an employee of the German company, you're doomed.
Finally, you have to be "attached to the social security system" in Czechia before you're posted to Germany. This means that you can't be sent directly to Germany on day one, but need to spend at least a month in Czechia before that.
All of this will come under thorough scrutiny by both the Czech and the German authorities as soon as you apply for the A1 form (and you have to do that if you want to legally work in another member state).
Most of this applies in a very similar fashion if you're self-employed. You can only work temporarily in Germany if you're "normally self-employed" in Czechia (you worked there before and are going to return) and you're going to do "similar" work in Germany.