Also within Germany the tax offices usually determine which tax office is responsible for you by asking where you were more than 180 days of the year (if e.g. you have a second flat where you work). That's a default value, though: in my experience you can ask to be handled by another tax office. E.g. I hand my tax declaration to my "home" tax office (where also my freelancing adress is), even though my day-job is 300 km away.
So if you work mostly from Poland and just visit the German customer a few times, you are fine anyways. Difficulties start if you move to Germany to do the work at your customer's place. I'm going to assume that this is the situation as otherwise I don't think the question would have come up.
temporary stay vs. permant residence
Close by the link you provided is a kind of FAQ on this EU regulation
About the question of permanent vs. temporary they say:
The temporary nature of the service is assessed on a case-by-case basis.
Here's my German-Italian experience with this.
Background: I had a work contract plus contracts for services and I moved for a while to Italy.
Taxes and social insurance on the Italian contracts had to be paid to Italy. Including tax on the contract for services. Due to the German-Italian tax treaty, there is no double taxation. Same for Poland: this is part of EU contracts.
By the way: The temporary time frame for Italy seemed to be 3 months, then I had to provide an Italian residence etc. and was registered in the Italian health care etc. system. Due to the German-Italian tax treaty, there is no double taxation. Same for Poland: this is part of EU contracts.
Besides that, the German tax office nevertheless decided that my "primary center of life" stayed in Germany. So everything but the stuff related to the Italian contracts (which would probably have counted as normal work contracts in Germany, though they is no exact equivalent to those contract types) was handled by the German tax office.
I think this is the relevant part for your question (or: argumentation with the German tax office) of temporary vs. permanent residence. Here are some points they asked:
- Where is your family living (Hint: say Poland)?
- Are you member of professional societies, unions, clubs, voluntary fire brigade etc: where?
- How long is the contract duration? (A not too long series of 1 year contracts was OK with Italy not becoming my center of life, but I also argued that some experience in a foreign country was expected at that stage of my career and that I planned to come back to Germany)
- How large is your flat (1 room counts towards temporary)
- How often and how long did I come back to Germany (several times/year for several weeks each stay)?
Providing Services in Germany at a Customer's place
There is one point you absolutely need to know about the German social insurance law: Scheinselbständigkeit (pretended self-employment). Scheinselbständigkeit means contracts that claim to be service contracts with a self-employed provider who is doing the work in a way that is typical for employees. This law closes a loophole so employer + employee cannot avoid paying income tax and social insurance fees (pension contributions and unemployment insurance on both sides - health insurance would have to be paid in full by the self-employed instead of partially by the employer. Employer also avoids accident insurance, and several regulations from labour law are avoided as well). Legally, this is a form of black labour which means that the employer commits a criminal offense and is liable basically for all those fees.
There is a list of criteria that count towards Scheinselbständigkeit. Particularly relevant for you could be
- Doing work that also other employees of the customer do
- Working in employee-style: at the customer's (as opposed to in your office in Poland), regular working hours, possibly having a key, customer telling you what to do, etc.
- The customer/employer is your main customer (most of your earnings, long-term business relationship, etc)
- You don't have any employees yourself.
This is the only point where you can actually argue that your tiny business has more difficulties than a big company. The German legislation instead argues that this is the price society has to pay in order to safe employees from being bullied into pretended self-employment where they are at the mercy of their de-facto employer who can circumvent the normal labour law regulations. However, one point in the criteria list is not enough to establish Scheinselbständigkeit. And you share this "discrimination" with any German one-person company.