Summary: there may be unethical details here. On the whole, I consider
- the professor offering you a job in their new group fair treatment
- that you cannot complain of not getting a job when you refuse to move there
- the ethics of the professor taking the grant with them unanswerable here
- a successful proposal a very important achievement for a fresh postdoc. This should show up in your CV and Arbeitszeugnis.
- the ethics of postdocs writing proposals complicated - thus long answer below.
I've known similar things happen. In the case I'm thinking of everyone stayed at the same institution, but someone else was assigned to do the research. The grant writer was not threatened by unemployment, though. To some extent, it would be seen as OK (solidarity as in: everyone may occasionally need a grant that they did not propose, so in turn, others occasionally need to write successful grants that they won't work on). But when this turned too disparate (someone writing several successful grants and not getting any of them for their resarch), it caused bad blood and IMHO rightly so.
I think your question hinges on whether it is ethical for the professor to take the grant with them. Which I think cannot be answered by strangers on the internet, since the answer would depend on details for the grant. However, such a move/change is certainly approved by the funding agency.
What you may do is contacting the funding agency to learn how they handle/consider changes such as the professor moving. It may also be instructive to learn what they expect of their applicants.
Without knowing further details, I think it quite likely that the funding agency considers the professor's research group a highly important "infrastructure" aspect for the grant* - and that would likely also have been the case with you as main applicant. It may also be that a fresh postdoc doesn't have any chance as applicant not because of lacking scientific ability but because they want to see someone experienced in the grant business and someone who is in a position to actually do hiring decisions.
Is it ethical that the professor uses his academic employees to write proposals
IMHO it is perfectly fine if a professor (or rather: a university) employs people to write proposals. This is certainly academic work. Unfortunately, it is a large part of academic work that is often not recognized and appreciated at its true importance.
From the employment perspective, the university pays a salary and gets written proposals in exchange. This is not different from hiring an employee to do research where salary is exchanged for research work.
Things turn murky when someone is told to write proposals who was hired for other work (e.g. doing research):
- On the one hand, most employment contracts that I've seen (I'm in germany) have a clause that allows the employer to assign the employee to other work (typically: at a comparable level of expertise). My guess would be that the writing of scientific proposals compared to doing research as postdoc would easily pass this test.
- On the other hand, if the employee was funded by grant money and several person-months of work went into writing proposals rather than research on the project that pays, this is IMHO corruption.
In academia, there's an additional conflict here: In industry, everyone knows that an employee is typically not allowed to talk too freely about what they did for their salary. In constast, in academia there is an assumption that the work can be judged correctly from what is publicly visible.
When that assumption is not met, difficulties ensue. This is the case with your proposal but it can happen also e.g. if the employer does not allow scientific publication of a piece of work - which is within their legal rights (legally speaking, you were compensated by your salary).
IMHO it is unethical to hamper your professional career by assigning you work that will not have the same visibility as the work you were hired for without any compensation or measures to mitigate this disadvantage. IMHO, a certain compensation may be reached quite easily:
am not getting any credit
That would clearly be unethical. Your Arbeitszeugnis should certify that you wrote a successful grant application. As a fresh postdoc, having written a successful grant proposal deserves to go into your CV, so when you apply for another job the hiring committee sees this experience.
What would also be clearly unethical is promising a grant to someone who writes a proposal and then breaking that promise. I'd also include deliberately creating the impression of such a promise as unethical.
But again, we strangers on the internet do not know here how much was actually promised to you vs. you not seeing the risks of the proposal not working out to a contract for you even though the proposal its granted.
For a fresh postdoc, I'd even say that a nice professor may prepare a "green" postdoc that things can go wrong. I would not call this an ethical obligation though, since it is somewhat in conflict with treating you on eye-level as a fully grown-up professional (who'd be aware of such risks without being told). In that case, misjudging your understanding of how academic funding works would not make this ethical misconduct.
and the project will move with him and another person will be hired for it, where I might be unemployed.
As I said above, we cannot know whether the grant should or even can stay at your university after the professor moved.
The professor asking you (= offering you a job at their new university) is very fair treatment. I therefore don't see cause for complaint for this aspect of the situation. Why you do not want to take this offer does not matter at all.
(If not all bridges are burnt by now, it may be worth while exploring whether you could work remotely/mostly remotely on that project - I'd think that right now, you may have extra-good chances with such a request).
Someone who wrote the proposal does have an "objective head start" compared to other applicants for the job since they are obviously up to date already with the topic. OTOH, hiring someone only because they wrote the proposal without considering other candidates could have a smell of nepotism, which would also be unethical.
it is normal to write a proposal for me when you are at the beginning of your postdoc
The professor may argue that this is ethical: starting a postdoc directly after PhD means that you are currently funded by a project that someone else wrote. The may argue that it is only fair if you work off this "debt" by writing a proposal that funds some other fresh postdoc.
In future, you may want to discuss very openly the implications and prospects for you when asked to write a proposal. Like discussing authorship right at the beginning of a collaborative paper, this is a lesson often painfully learned. And something that you may find difficult to achieve in practice (in particular as a still quite fresh postdoc).
I'd take good care to make clear that you do not want to question the good faith of your collaborators/professsors but that you need such things to be spelled out quite clearly for your own sake/for your own professional improvement/to better learn how academia works.
* I had a scholarship during my PhD time - the funding agency thought the research group aspect sufficiently important to ask me whether there's any other group where I could do the proposed research better than at my "home" group and offered to help with a transfer if so. (My project was quite interdisciplinary - they asked whether moving my "base camp" to the other discipline would help me)