According to section 42a Weapons Act (WaffG), Paragraph 1forbids:
- Knives with a blade that can be locked with one hand (one-hand knife) or fixed knives with a blade length of more than 12 cm respectively.
But, at Paragraph 2, there are two potentially relevant statutory defences to carrying such a knife home from the shop:
(2) Paragraph 1 does not apply:
- for transport in a closed container,
- for carrying the objects according to paragraph 1 nos. 2 and 3, provided that there is a legitimate interest.
And Paragraph 3 defines legitimate interest to mean:
(3) A legitimate interest pursuant to paragraph 2(3) exists in particular if the items are carried in connection with the exercise of a profession, the maintenance of customs, sport or a generally recognized purpose.
If, as user @o.m. pointed out in their comment, the knife remains in its original packaging - i.e. within a "closed container" - then Paragraph 2(2) would presumably apply.
If not, I strongly suspect that taking it home directly after buying it would be "a generally recognized purpose" so not prohibited under this Act.
(The above quotations are via Google Translate, and I've altered them slightly to make sense in English)