Complete prevention is usually not possible within classical open source. Projects can choose suitable licenses, governance, commercial agreements and a culture in which contributing back is normal.
Users can also take responsibility by returning maintenance, money or knowledge.