In a perfectly competitive market, this producer will lose the profit margin in the short run, and might have to go out of the market in the long run. Price is set by the market. Producers cannot raise price. But in the case of monopolist, when cost rises, the monopolist will raise price.