In case of monopolies, the price charged may be more than the marginal cost. In this case there will not be allocative efficiency in the economy. This is in contrast to perfect competition where the equilibrium level of output is always allocative efficient. Because in perfect competition, at equilibrium marginal cost is equal to price and so are marginal benefits.
Looking at the classic example of guns and butter. Suppose the economy decides to produce only guns (represents defense goods), economy can have productive efficiency if it produces the guns at the lowest possible costs. But it is unlikely that this economy would be allocative efficient. This is because the butter (represents consumer goods) is not being produced, the consumers require at least some quantity of butter as well.
This means that the allocation of resources does not represent the preferences of the society, they would like some combination of butter and guns but the economy is only producing guns. Thus, the economy does not have allocative efficiency.
