As /u/whatifonions pointed out, Marx only believed that communist society would be stateless. It's important to remember that socialist society exists in the interim, and the shift from socialism to communism can only come about when the threat of capitalist restoration is eradicated. His 1875 work The Critique of the Gotha Programme sums this up rather well when he says:
Between capitalist and communist society there lies the period of the revolutionary transformation of the one into the other. Corresponding to this is also a political transition period in which the state can be nothing but the revolutionary dictatorship of the proletariat.
Keep in mind that the terminology used here doesn't mean he supported literal one-man dictatorships, but a dictatorship of the entire proletariat over other classes in society, i.e. a worker's state that suppressed the bourgeoisie, any remnants of landed gentry, etc in order to have total and utter control of the state and society while transforming from capitalism into communism. (This would serve as the basis for the Leninist model of one-party states.)
However, we also do see some hints as to Marx's leanings on state power under socialism in a work by his colleague Friedrich Engels from around the same time period, 1872. Engels writes in his work, On Authority:
A number of Socialists have latterly launched a regular crusade against what they call the principle of authority. It suffices to tell them that this or that act is authoritarian for it to be condemned. This summary mode of procedure is being abused to such an extent that it has become necessary to look into the matter somewhat more closely.
Engels talks at length about his annoyances with anti-authoritarians in the piece, but I think his statement toward the end perhaps sums it up the best. Speaking of the Paris Commune, which both he and Marx admired:
[Anti-authoritarians] demand that the first act of the social revolution shall be the abolition of authority. Have these gentlemen ever seen a revolution? A revolution is certainly the most authoritarian thing there is; it is the act whereby one part of the population imposes its will upon the other part by means of rifles, bayonets and cannon — authoritarian means, if such there be at all; and if the victorious party does not want to have fought in vain, it must maintain this rule by means of the terror which its arms inspire in the reactionists. Would the Paris Commune have lasted a single day if it had not made use of this authority of the armed people against the bourgeois? Should we not, on the contrary, reproach it for not having used it freely enough? Therefore, either one of two things: either the anti-authoritarians don't know what they're talking about, in which case they are creating nothing but confusion; or they do know, and in that case they are betraying the movement of the proletariat. In either case they serve the reaction.
Marx only believed in the transition to a stateless society after the bourgeoisie had been completely defeated. I.e the entire world is socialist. This is the reason no communist states attempted it.
However, anarchists believe that a post-capitalist society should immediately transition to a stateless society, and so there were a few groups that have attempted this. These include the Revolutionary Insurrectionary army of Ukraine, an anarchist group in Ukraine during the Russian civil war, and the CNT-FAI, an anarcho-communist group in the Spanish civil war that controlled parts of Catalonia.